Magento add random string to email subject
When I receive emails from my magento carts contact form Gmail has a habit of combining them in a thread because they have the same subject.
Does 开发者_StackOverflow社区anyone know how I could add a random string of numbers to the subject line to prevent this?
(I know I can turn this feature off in Gmail but I like it for my other emails).
Thanks!
If this is the standard Contact form email, located under System>Transactional Emails (in my install this has the ID #1), just add {{var data.email}}
to the subject. That should fix your problem.
Personally, I would build your own contact us form that works with ajax and does a bit more than the basic form. The reason for this is that your contact us form is really important, possibly the most important page on your site.
With a 3-rd party contact us form you need not take people away from the product or category page they are on, you can also capture carriage return to behave like tab, put focus on the first box, add a capture, use a javascript to report back on computer/operating system/time spent on site/current page URL and anything else that is useful for converting a sale. You can also have 'how did you hear...' plus a captcha.
Maybe instead of:
$subject = "subject";
you could replace it with this code, adding a random number:
$subject = "subject ".rand(0,10000);
or better yet, instead of random number, use the date:
$subject = "Subject - ".date('r');
精彩评论