Guest Posted April 18, 2004 Posted April 18, 2004 This topic has been ground to dust in this forum, but I couldn't find an answer to my problem, so here we go again... I'm trying to send HTML emails, and I want any email sent (including Tell a Friend) to show the store logo on top, and be stylized in my stores colors. I'm using MS2.2 on a Linux server. My email settings are: E-Mail Transport Method: sendmail sendmail: LF Use MIME HTML When Sending Emails: true Verify E-Mail Addresses Through DNS: false Send out e-mails: true My store does send out emails, but they're not HTMLed. An example heared is attached: ##################### Return-Path: <[email protected]> Received: from sp0138.serverpronto.com ([64.251.10.92]) by fire.barak-online.net (InterMail vK.4.04.00.03 201-232-140-20030416 license ddbfb5ca0577fb4501d00fa8328b2217) with ESMTP id <[email protected]> for <[email protected]>; Sun, 18 Apr 2004 20:08:29 +0300 Received: by sp0138.serverpronto.com (Postfix, from userid 48) id 67BDB7F8A3; Sun, 18 Apr 2004 13:09:13 -0400 (EDT) To: "ethan" <[email protected]> Subject: It was in Hebrew, now you can see it. whatever... From: "ethan shalev" <[email protected]> MIME-Version: 1.0 X-Mailer: osCommerce Mailer Content-Type: multipart/alternative; boundary="=_ffc65342f318c339e3fc8c85d2c1f73c" Message-Id: <[email protected]> Date: Sun, 18 Apr 2004 13:09:13 -0400 (EDT) X-NAS-Bayes: #0: 1.51873E-025; #1: 1 X-NAS-Classification: 0 X-NAS-MessageID: 22391 X-NAS-Validation: {0BDDE57F-5D53-4C75-99ED-8F9CDF055A4A} --=_ffc65342f318c339e3fc8c85d2c1f73c Content-Type: text/plain; charset="iso-8859-8-i" Content-Transfer-Encoding: 7bit ################################# How do I change the Content-Type to text/HTML? And how can I define the colors and background colors I want? I couldn't find any information about this anywhere! Another problem I'm haveing with the emails (this was covered in the past, but I couldn't find a solution), is the fact that I don't get an email when an order is made. The customer does, and I added my email into the "send extra emails", and that works. But the default order recipient doesn't get them. Any help would be so terribly appreciated! -Ethan
nrlatsha Posted April 18, 2004 Posted April 18, 2004 There is a send html mail contrib out there, its for the welcome and/or the order page, but you can look at that code and port it to the other functions you need to do. 9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard) Replace that and you're fine...
Guest Posted April 18, 2004 Posted April 18, 2004 I'll look into that, but isn't sending styled emails built into osC? Thi shouldn't require a contribution... -Ethan
Guest Posted April 18, 2004 Posted April 18, 2004 I am now totally stomped! check this out: I justy installed Harald Ponce de Leon's E-Mail Testing Script, in order to try and locate my problem. I sent myself an email, with this in the body: <table align=center> <tr> <td> <img src=http://www.madab-il.com/catalog/images/madab-il_logo.gif> </td> <td bgcolor=eeaaff align=center> test this! </td> </tr> </table> Note: I deliberately ommited any "", 'cause I tought they might be causing trouble. Anyway, this email came as HTML edited, with a header of --=_ecf8fdd752c6fea6fc86195bb9cb06c7Content-Type: text/html; charset="iso-8859-8-i" Content-Transfer-Encoding: quoted-printable Now this is meant to be using the same sending function as the osC store itself, so I went to admin->tools-> send email, and pasted teh same exact code in the body. The email I received was not displayed as HTML, and only had a header of Content-Type: text/plain; charset="iso-8859-8-i"Content-Transfer-Encoding: 7bit Why is this happening? I'll keep looking for contributions, but I honestly don't beleive they're necasery. After all, I just sent a test HTML mail. I just need to do it of a regular basis. Help? -Ethan
Guest Posted April 19, 2004 Posted April 19, 2004 Anyone have any clues on this one? I mean, aparently myserver is cooperating, and allegedly, osC's mail function is capable of sending out HTML emails, but the store doesn't! Please help! -Ethan
langers Posted April 21, 2004 Posted April 21, 2004 Do you have "Use MIME HTML When Sending E-Mails" set to "true" in "Configuration->E-Mail Options" in the admin?
Guest Posted April 21, 2004 Posted April 21, 2004 yes I do (wrote so in initial post), and yet, it doesn't work... Do you have any idea what might be causing it?
Guest Posted April 24, 2004 Posted April 24, 2004 I got it fixed!!! In admin/mail.php, around line #42, i replaced $mimemessage->add_text($message); with $mimemessage->add_html($message); This makes me wonder: 1. How in the name of Zog is anyone else sending HTML messages, with the $mimemessage->add_text($message);?! 2. is there anything I shoud be aware of regarding the $mimemessage->add_html($message);? 3. Why doesn't the file check if I have my store set to send text or HTML messages, but rather assumes send_text? -Ethan
Jack_mcs Posted April 24, 2004 Posted April 24, 2004 I got it fixed!!! Congratulations on getting it to work. I've been fighting the same battle for months and still no progress. I'm curious if it works for you when you send an email from your site, like with Tell A Friend? I can send an HTML email from admin but anything from my site is sent as text. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Guest Posted April 24, 2004 Posted April 24, 2004 I just looked into it: tell a friend alters the text writen in the textarea by running it through a tep_db_prepare_input function. If you want customers to be able to send stylized messages, remove that call from $message = tep_db_prepare_input($HTTP_POST_VARS['message']); I'd advise against it, because customers could then ruin any HTML you entered, by ending a table or something of that sort...
Jack_mcs Posted April 25, 2004 Posted April 25, 2004 Thanks for looking into it. However, I wasn't thinking about customers being able to send HTML in Tell A Friend. I doubt that most would want to bother with it if they knew how. What I was talking about was the part of the message that is generated by the file itself. The message says someting like "To view the product click on the link below..." and then a URL to the product or the catalog is displayed. That URL should be, IMO, a workable link but it isn't, at least not for my shop. The code for tell_a_friend.php shows it being added as a link: $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])) . "\n\n" . but it doesn't arrive that way. Does this happen in your shop also? Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Guest Posted April 26, 2004 Posted April 26, 2004 I have this problem too. Any email sent as HTML kills the links within it. This is the next thing on my todo list - fixing this bug! Regarding how to change the look and feel of every mail sent from the store, see this post of mine -Ethan
Jack_mcs Posted April 26, 2004 Posted April 26, 2004 Ahh, thanks Ethan. I, for one, will thank you if you can figure it out. As I'm sure you know, there are many posts on the forums about email not working properly so we are not the only ones experiencing this. I tried your code from the other thread. That's a move in the right direction I think. Good luck on your bug hunting. :) Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Guest Posted April 26, 2004 Posted April 26, 2004 This just occured to me: when an email is read as plain text, the mail client knows to read the URLs and mail links as hyperlinks, but when viewed as HTML it doesn't. In that case, all that has to me done is alter the HTML code sent out, to reflect the fact that this is in fact a link. After all, if you're using HTML (Thought the mail client,) you should tell the client how to display and trat everything. I just tested the following, and it was a success: in catalog/includes/english/create_account.php, I had . STORE_OWNER_EMAIL_ADDRESS . as part of the content of the email sent out. I replaced it with the following: <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>' . And the email link works! I had considered using diferent text for the link (such as <a href="mailto:[email protected]">click here</a>), but then, if the message is viewed by the customer as plain text, he won't see the address, and the "click here" won't be, uhm, clickable. I am now going all the pages that send out emails, and modifying them. Let me know how it goes for you, -Ethan
esifis Posted April 26, 2004 Posted April 26, 2004 Dear friends I am also trying to send to my customer html email (I hope that for newsletter is the same) , and I manage to do this only after I change the $mimemessage->add_html($message); The Big problem now is that when I am trying to send the html email by copying the source code to the email area , the mail come to me and the oscommerce has add to every line change the <br> tag. All the other code the image the links is ok but with to many <br> . I have try almost everything but the problem remain the same. Any help please?
Jack_mcs Posted April 27, 2004 Posted April 27, 2004 I just tested the following, and it was a success:in catalog/includes/english/create_account.php, I had . STORE_OWNER_EMAIL_ADDRESS . as part of the content of the email sent out. I replaced it with the following: <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>' . And the email link works! I am now going all the pages that send out emails, and modifying them. Let me know how it goes for you, -Ethan Good thinking. :) For some reason though I can't get it to work. Here's the code I changed define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: ' . '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>' . '.' . "\n\n"); define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to ' . '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>' . '.' . "\n"); But the email contains EMAIL_GREET_NONEEMAIL_WELCOMEEMAIL_TEXTEMAIL_CONTACTEMAIL_WARNING and the subject says EMAIL_SUBJECT. Any idea what me be causing this? Would you know if there is and easier way to test this? Deleting the new account each time is quite time consuming. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Guest Posted April 27, 2004 Posted April 27, 2004 esifis, your problem is being caused by the fact that osC translates line breaks into actual breaks in the text (with the nl2br function). to solve this, and to reduce the size of the emails you send out, get rid of spaces and line breaks. In this regard, the formatting of the code is not relevant. write it as you normally would, so you could follow your tables, fonts and what-nots, but before you copy-paste it, make all the code into one long line. This will solve your problem, and reduce the size of the mail - when you send it out to 1000 customers, every byte counts to your mail server! Jack_mcs, I went over your code, and I can't find any problems! Have you made any other changes? You could reduce the compexity of it (and the chances of an eror I may have missed), by fixing it up a little: replace define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: ' . '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>' . '.' . "\n\n");define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to ' . '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>' . '.' . "\n"); with define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>.' . "\n\n");define('EMAIL_WARNING', '<b>Note:</b> This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>.' . "\n"); I simply connected several HTML substrings, that had no PHP betwween them. no need to separate them. I can't think of any other way of testing this besides creating dummy accounts. Made and deleted three yesterday... There should be a shorter way or writing this code, using the sprintf function (which is in use here anyway), but I don't know PHP well enough to make the modifications. see PHPfreaks example #4, to see what I mean. What I would love, would be the option of sending out an email with seperate text in the text/plain part and in the text/html part, that way you could in fact have the link with a diferent title other then it's own URL, and still, if viewed as plain text, would have an active link... -Ethan
Jack_mcs Posted April 28, 2004 Posted April 28, 2004 Thanks Ethan. Your change fixed the problem. I didn't realize your were removing the php part of the string. Thanks for your changes. This is a nice improvment over what was. Hopefully this will all be resolved in the next release. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
korsh Posted April 29, 2004 Posted April 29, 2004 hello all, I have just set up a html email thanks to Ethan's posts and also solved one aspect of the problem of the html killing the links. Here is what I did for the detailed account link. EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . '">View Detailed Account</a>' . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; this creates ------------------------------------------------------------------------------------ Order Number: 10018 View Detailed Account Date Ordered: Thursday 29 April, 2004 James
Guest Posted April 29, 2004 Posted April 29, 2004 korsh, The problem with the meethod you used (and perhaps i didn't clarify this enough before), is that though you send out the email as HTML, a customer could choose to have mails displayed as plain-text only. one reason for this is to prevent spammers from validating your email address. But that's a topic for a later time... Anyway, if your message is viewd as plain-text, your customer will see Order Number: 10018View Detailed Account Date Ordered: Thursday 29 April, 2004 without anything being clickable. If, on the otherhand, you were to use the URL itself as the displayed text, most email clients will make it clickable when viewed as plain-text, and even if not, the customer could at least copy-paste the URL... I suggest you take a look at the email you sent in plain-text, to see exacly what I mean. If you don't know how, let me know wht mail client you're using and I'll try to help. -Ethan
korsh Posted April 29, 2004 Posted April 29, 2004 Hi Ethan, I see what you mean. One way around that could be EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . '">View Detailed Account</a>' . "\n" . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n"; to produce this in text view Order Number: 10023 View Detailed Account http://mysite/catalog/account_history_info...?order_id=10023 Date Ordered: Friday 30 April, 2004 and this in HTML Order Number: 10023 View Detailed Account http:://mysite/catalog/account_history_info.php?order_id=10023" Date Ordered: Friday 30 April, 2004 however I made some links also in the header and they are now broken and the text formatting is gone. I'm not so sure how to get around those aesthetically. To ensure that you continue to receive the our newsletter,please add newsletter to your address book.Browse: Product List Order Acknowledgement Thank you for your order .......... I will keep at it. Thanks for pointing out the problem, I hadn't completely understood it and now I have one the opportunity to learn more. James
Guest Posted April 29, 2004 Posted April 29, 2004 korsh, THe solution you came up with, though fuctional, seems a little redundant. in HTML mode, why have an active link and under it a dead URL? It might be pasable, if the text were to be something like: Click here, or copy-paste the limk below or something like that... In my opinion (and I hope someone with more osC or emailing knowledge reads this), the best solution would be if you could create the plain-text part of the message seperately from the HTML part. hat way, you could control what the cuastomer will see in either situation, without the two being related to each another. About the new problem you have now - I didn;t quite understand you. Could you please explain a little further? -Ethan
korsh Posted April 29, 2004 Posted April 29, 2004 I didn't understand enough of css to follow you addition to catalog/includes/functions/general.php I figured it out, with some help from a friend:in catalog/includes/functions/general.php, look for a function named tep_mail. After the lines QUOTE // Build the text version $text = strip_tags($email_text); Add the following, where what you see below is what I have, you will undoubtedly want to change it to fit your style, and not to display my logo on your emails: QUOTE // Customizing the HTML version of the message $email_text = '<body style="width: 100%; padding: 0px; margin: 0px; background-color: #effaff;"><div style="width: 100%; background-color: #66ccff; text-align: right; direction: rtl; padding: 0px; margin: 0px;"><a href="http://www.madab-il.com/"><img style="padding: 0px;" src="http://www.madab-il.com/catalog/images/madab-il_logo.gif" border=0></a></div><div lang="he" DIR="rtl" style="padding: 0px; background-color: #6080C2; direction: rtl; font-family: arial; font-size: 6px;"> </div><div lang="he" DIR="rtl" style="padding: 10px; background-color: #effaff; direction: rtl; font-family: arial; font-size: 12px;">'.$email_text.'</div></body>'; so I had a go making a table in catalog/checkout_process.php // lets start with the email confirmation $email_order = '<table cellspacing=0 cellpadding=0 width="600" border=0><tr><td width="21%"><a href="http://www.mysite/index.html" border="0"><img src="http://www.mysite/images/my_logo.jpg" height=83 width=160 border=0></a></td><td valign=center align=right width="79%"><b><font face=Arial,Helvetica,sans-serif size=1 >To ensure that you continue to receive the our newsletter,<br>please add </font></b><font face=Arial,Helvetica,Sans-serif size=1><a href="mailto:myname@mydomain?subject=newsletter mail out">newsletter</a></font><font face=Arial,Helvetica,Sans-serif size=1> <b>to your address book.</b><br><br></font><b><font face="Arial, Helvetica, sans-serif" color=#6699cc size=2>Browse: <a href="http://mysite/catalog/catalog_products_with_images.php" target="blank">Product List</a><br></font></b></td></tr><tr><td width="21%" height=7 bgcolor="#E41F1C"><font face="Arial, Helvetica, sans-serif" color=#ffffff size=2 ></font></td><td width="79%" bgcolor=#E41F1C height=7><div align=right><font face="Arial, Helvetica, sans-serif" color=#ffffff size=2><b>Order Acknowledgement</b></font></div></td></tr></table>'. "\n" . I am at present looking again at the code you wrote for catalog/includes/functions/general.php and am making some progress. I have managed to build the header with the logo but not yet added the links. James
Recommended Posts
Archived
This topic is now archived and is closed to further replies.