E-Mail Templates

Started by retched on 21 Jan 2011, 12:10 AM · Views: 8,708

Results 1 to 14 of 14
21 Jan 2011, 12:10 AM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

E-Mail Templates

I'm trying to write a module that uses email templates in the /email/ directory. While the HTML version the email sends OK, the plain text version seems to send along the CSS coding. Other than making a CSS file and remote referencing to my site, which will likely be blocked by most email programs anyway, does anyone have and idea of how to stop having the CSS code appear?

21 Jan 2011, 3:32 AM
#2
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: E-Mail Templates

I don't think you are supposed to include any CSS in a text email, that's why it's a text email.:P:D So you will need two email templates.


Zen Cart and it's community are the best!!

21 Jan 2011, 6:32 AM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: E-Mail Templates

But CSS is included in the default (installed) HTML files in the same directory. So it's included as well but works fine with those templates unless I'm doing something wrong.

21 Jan 2011, 8:12 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,124
Plugin Contributions:
56

Re: E-Mail Templates

The templates in your /email directory are used for sending HTML emails only. Text-based email is built by whatever PHP file you're using to create the communication.

21 Jan 2011, 10:37 PM
#5
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: E-Mail Templates

lat9:

The templates in your /email directory are used for sending HTML emails only. Text-based email is built by whatever PHP file you're using to create the communication.

Aha... I was going to assume that next. So I guess at the send time, I would have to check for the customers email option choice?

24 Jan 2011, 7:51 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,124
Plugin Contributions:
56

Re: E-Mail Templates

Take a look at /includes/modules/create_account.php, which contains code to send the customer a welcome e-mail when they create an account. This uses the template file /email/email_template_welcome.html if the customer has indicated that s/he wants HTML-formatted e-mail.

Towards the end of the PHP file is where the message is built, starting with the comment "// build the message content". You'll see that a text message string is built as well as the content required for the HTML template, followed by a call to zen_mail (in /includes/functions/functions_email.php) which determines whether to send TEXT or HTML based on the customer's preference in your database.

25 Jan 2011, 5:53 PM
#7
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: E-Mail Templates

lat9:

Take a look at /includes/modules/create_account.php, which contains code to send the customer a welcome e-mail when they create an account. This uses the template file /email/email_template_welcome.html if the customer has indicated that s/he wants HTML-formatted e-mail.

Towards the end of the PHP file is where the message is built, starting with the comment "// build the message content". You'll see that a text message string is built as well as the content required for the HTML template, followed by a call to zen_mail (in /includes/functions/functions_email.php) which determines whether to send TEXT or HTML based on the customer's preference in your database.

This works perfectly for what I was needing to do. Thanks.;

21 Feb 2011, 7:41 PM
#8
kwright avatar

kwright

Zen Follower

Join Date:
Nov 2004
Posts:
355
Plugin Contributions:
0

Re: E-Mail Templates

This was very helpful to me...been working with zen_mail and was confused as to why when I sent test mail to two different addresses, the mail was not the same.

The test account email was set to HTML and the admin email was text only. I was missing the code that put the $email_text content into the EMAIL_MESSAGE_HTML array element!

Thanks :clap:

Experience is what you get when you don’t get what you want…

1 May 2011, 8:12 PM
#9
hara avatar

hara

Zen Follower

Join Date:
Sep 2008
Posts:
397
Plugin Contributions:
0

Re: E-Mail Templates

retched:

This works perfectly for what I was needing to do. Thanks.;

Hi retched,

When your email-template be come available? I can't wait...

Can you help with my current issue on Create account welcome email? Image and link not show up. I don't what's wrong with the codes.

http://www.zen-cart.com/forum/showpost.php?p=1022416&postcount=5

Thanks in advance!

8 May 2011, 10:17 PM
#10
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: E-Mail Templates

hara:

Hi retched,

When your email-template be come available? I can't wait...

Can you help with my current issue on Create account welcome email? Image and link not show up. I don't what's wrong with the codes.

http://www.zen-cart.com/forum/showpost.php?p=1022416&postcount=5

Thanks in advance!

Oh this was in regards to the SnapAffiliates module emails... they were sent out kind of... half-assedly, so now I have to rewrite that portion of code. I'll be glad to help with your problem though on that topic page.

1 Aug 2011, 3:39 PM
#11
hara avatar

hara

Zen Follower

Join Date:
Sep 2008
Posts:
397
Plugin Contributions:
0

Re: E-Mail Templates

retched:

This works perfectly for what I was needing to do. Thanks.;

Hi retched,

How is your email template? I'm looking for three rows with out line border table code email template. First row for logo image, 2nd for text content and 3rd for something els. Any help would be appreciated.

2 Dec 2011, 1:22 PM
#12
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

Re: E-Mail Templates

lat9:

Take a look at /includes/modules/create_account.php, which contains code to send the customer a welcome e-mail when they create an account. This uses the template file /email/email_template_welcome.html if the customer has indicated that s/he wants HTML-formatted e-mail.

Towards the end of the PHP file is where the message is built, starting with the comment "// build the message content". You'll see that a text message string is built as well as the content required for the HTML template, followed by a call to zen_mail (in /includes/functions/functions_email.php) which determines whether to send TEXT or HTML based on the customer's preference in your database.

What is the best way to change the font size for text emails?

Thanks

ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

2 Dec 2011, 1:30 PM
#13
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: E-Mail Templates

What is the best way to change the font size for text emails?You can't. Text means plain text, which will display at whatever font and size the recipient has set on their computer.

2 Dec 2011, 1:40 PM
#14
idc1 avatar

idc1

Zen Follower

Join Date:
Jul 2011
Posts:
139
Plugin Contributions:
0

Re: E-Mail Templates

gjh42:

You can't. Text means plain text, which will display at whatever font and size the recipient has set on their computer.

Thank you for the clarification!

ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3