Guest Posted April 24, 2004 Posted April 24, 2004 Hi, I know this is possible, only I don't know how: I want every email sent from the site (also if sent by a customer via Tell A Friend), to have my store logo on top, or some other HTML. Maybe put the text in a table cell or something. Also, I want to add an unsubscribe link to the newsletter. I found a contribution for the latter part, but I don't want to install it if I will then have to redo everything in order to style the rest of the message. Can emails link to a stylesheet? I'm sure many of you send out good looking HTML based emails, and I'd like some pointers regarding the design, do's and dont's and setting the whole thing up. -Ethan
Pompeylad Posted April 24, 2004 Posted April 24, 2004 I would also like to know how to do this. Pompeylad. PHP?!? Long live HTML!!!! But then again we never stop learning.
Guest Posted April 25, 2004 Posted April 25, 2004 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 // 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: // 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>'; Notice that what I've done is take the $email_text string the function receives, and added the formatting and anything else I want around it. I suppose the next step, in the name of proper coding, would be to refer it to an external stylesheet, and perhaps also to email_header and email_footer files that can be edited without having to touch the general functions file. If anyone has a good idea on how to do this, I'd be thrilled! -Ethan
ausipodskins Posted May 24, 2004 Posted May 24, 2004 thanks for this code. for anyone wanting to use this code, please note that it only seems to apply to order confirmation emails AND that the sent email text is right-justified as well as partially reading from right-to-left. I have converted it to left-right text by using the following elements in the appropriate places: text-align: left direction: ltr lang="en" My next mission is to discover why emails sent via the "send email" tool in admin aren't formatted using the changes to general.php. If anyone knows where those changes should be made I'd be grateful for the hint.
dasaro Posted July 30, 2004 Posted July 30, 2004 thanks for this code. for anyone wanting to use this code, please note that it only seems to apply to order confirmation emails AND that the sent email text is right-justified as well as partially reading from right-to-left. I performed this mod and found it to apply to several other email formats, such as Tell A Friend and account creation emails. I really appreciate this post and what it has done for my emails!!!! Also, I found it useful to center the logo, while keeping the text left justified. Do that by using this code. // Customizing the HTML version of the message $email_text = '<body style="width: 100%; padding: 0px; margin: 0px; background-color: #b7c3d0;"><div style="width: 100%; background-color: #ffffff; text-align: center; direction: ltr; padding: 0px; margin: 0px;"><a href="http://www.toomanytools.com/"><img style="padding: 0px;" src="http://www.toomanytools.com/images/toomanytools.jpg" border=0></a></div><div lang="en" DIR="rtl" style="padding: 0px; background-color: #33328f; direction: ltr; font-family: arial; font-size: 6px;"> </div><div lang="en" DIR="ltr" style="padding: 10px; background-color: #b7c3d0; text-align: left; direction: ltr; font-family: arial; font-size: 12px;">'.$email_text.'</div></body>';
Guest Posted February 8, 2005 Posted February 8, 2005 I feel your frustration with the organization of combing over the threads and found yours to be helpful. (I would love it if they organized the threads a little better. they could have a 'subject/content' and have it propegate all the associated topics...enough ranting i have my hack hat on today) Although when I tried to edit the catalog/functions/general.php with the proposed ----------------------------------------- // 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>'; ------------------------------------------------------ the images/the html dont transmit into the email. what i've done thus far I have changed in admin/includes/modules/newsletters/newsletter.php around line 63 from $mimemessage->add_text($this->content); to $mimemessage->add_html($this->content); --------- I thought that maybe it was affecting an email other than the newsletter and checked and nope. any ideas? thanks i might just start from scratch and see if i missed a step thanks in advance.
Guest Posted February 8, 2005 Posted February 8, 2005 oh and this is the placement of where I put the above suggestion...i also tried removing the $text = strip_tags($email_text) and replacing with above suggestion to see if that might work (again hack hat on) and that didn't work... ? ?// Build the text version ? ?$text = strip_tags($email_text); // 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>'; ? ?if (EMAIL_USE_HTML == 'true') { ? ? ?$message->add_html($email_text, $text); ? ?} else { ? ? ?$message->add_text($text); ? ?}
Recommended Posts
Archived
This topic is now archived and is closed to further replies.