Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Archived

This topic is now archived and is closed to further replies.

Guest

Emails in html format

Recommended Posts

Guest

Hi

 

I can't find where this has been asked/answered before.

 

Despite setting in admin to send html emails to true, it never ever happens. To prove it, I have just installed another OSC test store with no contributions installed. I set admin to send html, then created an account, and the received e-mail is in text.

 

Does anyone know how to get all sent emails to be in html format, not just invoices? Ideally, it would have a text component for those that do not want to receive html e-mails.

 

If the standard osc does not do it, is there a workable contrib that would do it?

 

Thank You for your indulgence.

Share this post


Link to post
Share on other sites
Guest
Hi

 

I can't find where this has been asked/answered before.

 

Despite setting in admin to send html emails to true, it never ever happens. To prove it, I have just installed another OSC test store with no contributions installed. I set admin to send html, then created an account, and the received e-mail is in text.

 

Does anyone know how to get all sent emails to be in html format, not just invoices? Ideally, it would have a text component for those that do not want to receive html e-mails.

 

If the standard osc does not do it, is there a workable contrib that would do it?

 

Thank You for your indulgence.

Guess not.

Share this post


Link to post
Share on other sites
Guest

Try the email templates contrib. You may need to customize it for the osc email page and add an html format tool like tinymce for instance. I know the module works so you could give it a shot.

Share this post


Link to post
Share on other sites
Guest
Guess not.

I seem to be having the same problem, sort of... when I create an HTML email in the newsletter section and preview it, it looks fine... and then once it is sent to all the customers it just shows up as pure code, and I really don't know why this is happening... or, perhaps this is supposed to happen, as HTML is not supported for the newsletters???

Share this post


Link to post
Share on other sites

To be able to send html emails and newsletters, you have to change a couple of lines of code.

 

In admin/mail.php on line 42, you'll see this:

 

	$mimemessage->add_text($message);

 

 

Change it to this:

 

	$mimemessage->add_html($message);

 

 

In admin/includes/modules/newsletters/newsletter.php on line 63:

 

	  $mimemessage->add_text($this->content);

 

 

 

To this:

 

	  $mimemessage->add_html($this->content);

 

 

Make sure in Admin/Configuration/E-Mail Options you have "Use MIME HTML When Sending Emails" set to true and you should be good.

Share this post


Link to post
Share on other sites
Guest
To be able to send html emails and newsletters, you have to change a couple of lines of code.

 

In admin/mail.php on line 42, you'll see this:

 

	$mimemessage->add_text($message);

Change it to this:

 

	$mimemessage->add_html($message);

In admin/includes/modules/newsletters/newsletter.php on line 63:

 

	  $mimemessage->add_text($this->content);

To this:

 

	  $mimemessage->add_html($this->content);

Make sure in Admin/Configuration/E-Mail Options you have "Use MIME HTML When Sending Emails" set to true and you should be good.

 

That is super! Thank you so much, something so simple that I have been meaning to fix for so long, but just always got put to one side. Thanks again, seems to work fine now :)

Share this post


Link to post
Share on other sites
Guest
To be able to send html emails and newsletters, you have to change a couple of lines of code.

 

In admin/mail.php on line 42, you'll see this:

 

	$mimemessage->add_text($message);

Change it to this:

 

	$mimemessage->add_html($message);

In admin/includes/modules/newsletters/newsletter.php on line 63:

 

	  $mimemessage->add_text($this->content);

To this:

 

	  $mimemessage->add_html($this->content);

Make sure in Admin/Configuration/E-Mail Options you have "Use MIME HTML When Sending Emails" set to true and you should be good.

OK, I have made those changes in a fresh install, and the welcome email and order process email still appears as text. Is there something else that needs to be done.

Share this post


Link to post
Share on other sites

Leslie,

 

Other than some bold and list tags in the welcome email, they are pretty much text anyway.

 

define('EMAIL_SUBJECT', 'Welcome to ' . STORE_NAME);
define('EMAIL_GREET_MR', 'Dear Mr. %s,' . "\n\n");
define('EMAIL_GREET_MS', 'Dear Ms. %s,' . "\n\n");
define('EMAIL_GREET_NONE', 'Dear %s' . "\n\n");
define('EMAIL_WELCOME', 'We welcome you to <b>' . STORE_NAME . '</b>.' . "\n\n");
define('EMAIL_TEXT', 'You can now take part in the <b>various services</b> we have to offer you. Some of these services include:' . "\n\n" . '<li><b>Permanent Cart</b> - Any products added to your online cart remain there until you remove them, or check them out.' . "\n" . '<li><b>Address Book</b> - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves.' . "\n" . '<li><b>Order History</b> - View your history of purchases that you have made with us.' . "\n" . '<li><b>Products Reviews</b> - Share your opinions on products with our other customers.' . "\n\n");
define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "\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 ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "\n");

 

Are you seeing bold text in your emails? Have you changed the message?

Share this post


Link to post
Share on other sites
Guest
OK, I have made those changes in a fresh install, and the welcome email and order process email still appears as text. Is there something else that needs to be done.

is that on a dedicated server? I've seen cases where there are controls from the host cpanel that can affect html with emails. (like email queues)

 

If you setup a simple script to send an html mail what happens? Also when you receive the emails you can check the headers (MIME-Version, Content-Type etc). What do they show?

Share this post


Link to post
Share on other sites
Guest
is that on a dedicated server? I've seen cases where there are controls from the host cpanel that can affect html with emails. (like email queues)

 

If you setup a simple script to send an html mail what happens? Also when you receive the emails you can check the headers (MIME-Version, Content-Type etc). What do they show?

Hi Mark

 

Only done this on my test site on my PC under wamp. I installed the oscommerce-2.2rc1 and tried it that.

 

The other 4 sites all have incomlete attempts at getting html emails working by installing some contribs. No of which has been suitable.

 

Here is the header of an order update email (personal details replaced with xxx):

 

Return-Path: <xxxx@xxxx>

Delivered-To: xxxxx@xxxxx

Received: (xxxx xxxx invoked by uid 399); 8 Jul 2007 10:13:59 -0000

X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on xxxxxxxx

X-Spam-Level:

X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_MESSAGE,RDNS_NONE

autolearn=disabled version=3.2.1

Received: from unknown (HELO mail17.xxxxxxxxx) (xxxxxxxx)

by mail1.xxxxxxxx with ESMTP; 8 Jul 2007 10:13:59 -0000

X-Originating-IP: xxxxxxx

Received-SPF: none (mail1.xxxxxx: domain at xxxxxxxxdoes not designate permitted sender hosts)

identity=mailfrom; client-ip=xxxxxx;

envelope-from=<xxxxxxx>;

Received: from AsrockP4 (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[xxxxxxxx])

by mail17.xxxxxxxxxxxxxxxxx(xxxxxxxxxxxxxx) with SMTP id l68ADvQa004923

for <"Leslie Cooper" <xxxxxxxxxxxxxxxxxxxxxxx>>; Sun, 8 Jul 2007 20:13:58 +1000

Message-Id: <200707081013.l68ADvQa004923@mail17.xxxxxxxxxxxxxxxxxxxxxxxxx>

Date: Sun, 08 Jul 2007 20:12:54 +1000

Subject: Order Update

To: "Leslie Cooper" <xxxxxxxxxxxxxxxxxxxxxx>

From: "Coopco" <xxxxxxxxxxxxxxxxxxx>

MIME-Version: 1.0

X-Mailer: osCommerce

Content-Type: multipart/alternative;

boundary="=_f672a8ffa0084fa7c26c497aebc1ae69"

 

Here is the body of the email when I view source:

 

The Coopco e-Shop<br>------------------------------------------------------<br>Order Number: 1<br>Detailed Invoice: http://localhost/coopco.asrock/osc22rc1/ac...1<br>Date Ordered: Saturday 07 July, 2007<br><br>The comments for your order are<br><br>Test of email.<br><br><br><br>Your order has been updated to the following status.<br><br>New status: Processing<br><br>Please reply to this email if you have any questions.<br>

Share this post


Link to post
Share on other sites
Guest
Hi Mark

 

Only done this on my test site on my PC under wamp. I installed the oscommerce-2.2rc1 and tried it that.

 

The other 4 sites all have incomlete attempts at getting html emails working by installing some contribs. No of which has been suitable.

 

Here is the header of an order update email (personal details replaced with xxx):

 

Return-Path: <xxxx@xxxx>

Delivered-To: xxxxx@xxxxx

Received: (xxxx xxxx invoked by uid 399); 8 Jul 2007 10:13:59 -0000

X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on xxxxxxxx

X-Spam-Level:

X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_MESSAGE,RDNS_NONE

autolearn=disabled version=3.2.1

Received: from unknown (HELO mail17.xxxxxxxxx) (xxxxxxxx)

by mail1.xxxxxxxx with ESMTP; 8 Jul 2007 10:13:59 -0000

X-Originating-IP: xxxxxxx

Received-SPF: none (mail1.xxxxxx: domain at xxxxxxxxdoes not designate permitted sender hosts)

identity=mailfrom; client-ip=xxxxxx;

envelope-from=<xxxxxxx>;

Received: from AsrockP4 (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[xxxxxxxx])

by mail17.xxxxxxxxxxxxxxxxx(xxxxxxxxxxxxxx) with SMTP id l68ADvQa004923

for <"Leslie Cooper" <xxxxxxxxxxxxxxxxxxxxxxx>>; Sun, 8 Jul 2007 20:13:58 +1000

Message-Id: <200707081013.l68ADvQa004923@mail17.xxxxxxxxxxxxxxxxxxxxxxxxx>

Date: Sun, 08 Jul 2007 20:12:54 +1000

Subject: Order Update

To: "Leslie Cooper" <xxxxxxxxxxxxxxxxxxxxxx>

From: "Coopco" <xxxxxxxxxxxxxxxxxxx>

MIME-Version: 1.0

X-Mailer: osCommerce

Content-Type: multipart/alternative;

boundary="=_f672a8ffa0084fa7c26c497aebc1ae69"

 

Here is the body of the email when I view source:

 

The Coopco e-Shop<br>------------------------------------------------------<br>Order Number: 1<br>Detailed Invoice: http://localhost/coopco.asrock/osc22rc1/ac...1<br>Date Ordered: Saturday 07 July, 2007<br><br>The comments for your order are<br><br>Test of email.<br><br><br><br>Your order has been updated to the following status.<br><br>New status: Processing<br><br>Please reply to this email if you have any questions.<br>

Same result with my store for the create account email. This is on a dedicated server.

Share this post


Link to post
Share on other sites
Guest
Same result with my store for the create account email. This is on a dedicated server.

 

Something on the server must causing this problem. To rule this out try a simple script on its own like:

 

<?php 
$header = "From: me@home.com \r\n"; 
$header.= "Content-Type: text/html; charset=ISO-8859-1 "; 
$header .= "MIME-Version: 1.0 "; 
$body='<b>HTML Email</b>';   
mail("your_mail@domain.com", "HTML Test Message", $body, $header); 
?>

Do you receive html with that?

(change the email address to be valid)

Share this post


Link to post
Share on other sites
Guest
Something on the server must causing this problem. To rule this out try a simple script on its own like:

 

<?php 
$header = "From: me@home.com \r\n"; 
$header.= "Content-Type: text/html; charset=ISO-8859-1 "; 
$header .= "MIME-Version: 1.0 "; 
$body='<b>HTML Email</b>';   
mail("your_mail@domain.com", "HTML Test Message", $body, $header); 
?>

Do you receive html with that?

(change the email address to be valid)

Hi Mark

 

Thanks for your time.

Will do.

To give you further background, I installed a contrib in my store to give emails in html format. The store owner and extra emails do receive in html format, the customer does not.

Share this post


Link to post
Share on other sites
Guest
Hi Mark

 

Thanks for your time.

Will do.

To give you further background, I installed a contrib in my store to give emails in html format. The store owner and extra emails do receive in html format, the customer does not.

Hi Mark

 

The email received had HTML Email in bold black lettering. There is absolutely no indication that it is htm format. Really it is no different to the other emails.

Share this post


Link to post
Share on other sites
Guest
Hi Mark

 

The email received had HTML Email in bold black lettering. There is absolutely no indication that it is htm format. Really it is no different to the other emails.

If I understand correctly, you mean that small code sample did work?

(you could change that text to add some more html tags just to be sure).

Share this post


Link to post
Share on other sites
Guest

I've been thinking about using html emails myself for quite a while, and have a slightly different way around the issue.

 

I spent quite a while creating a custom outlook template which has a standard company disclaimer, header and footer, so wantyed to utilise it.

 

When a new customer signs up, you can have OSC send you an email, or when someone places an order etc etc. Simply set some rules up in Outlook, so that whenever an email comes in with a specific subject, you send a certain email back out. Thus you can utilise the fancy email functions, and you will also have a record of all emails being sent in your sent items folder.

 

The downside of this is that you will have to have a PC logged into outlook at all times, or customers will have to wait for their notification emails until you next load outlook.

 

Hope this helps some of you.

Share this post


Link to post
Share on other sites
Guest
If I understand correctly, you mean that small code sample did work?

(you could change that text to add some more html tags just to be sure).

Yes that did work. All of the html formatting info was there.

Share this post


Link to post
Share on other sites
Guest
Yes that did work. All of the html formatting info was there.

The email received had HTML Email in bold black lettering. Really it is no different to the other emails. No colour, no graphics.

Share this post


Link to post
Share on other sites
OK, I have made those changes in a fresh install, and the welcome email and order process email still appears as text. Is there something else that needs to be done.

 

I had this same issue. For me, I had also installed the Admin Edit Emails contribution, so I had to go to my Admin->Configuration->Email Templates. It turned out, the html didn't look like <b> in their, it looked something like &gtb<

 

Once I corrected the garbled html code (which prints <b> rather than causing bold text) everything works!

 

Hope this helps you.


~Tracy
 

Share this post


Link to post
Share on other sites
Guest
I had this same issue. For me, I had also installed the Admin Edit Emails contribution, so I had to go to my Admin->Configuration->Email Templates. It turned out, the html didn't look like <b> in their, it looked something like &gtb<

 

Once I corrected the garbled html code (which prints <b> rather than causing bold text) everything works!

 

Hope this helps you.

Hi Tracy

Thank you for posting. I do not know the contrib you mentioned. Can you please let me know what it is.

Share this post


Link to post
Share on other sites
The email received had HTML Email in bold black lettering. Really it is no different to the other emails. No colour, no graphics.

 

Have you actually tried to add some colour and graphics? If you can see bold text, then you will be able to see coloured text and images, so long as you put them in place.

Share this post


Link to post
Share on other sites
Guest
Have you actually tried to add some colour and graphics? If you can see bold text, then you will be able to see coloured text and images, so long as you put them in place.

Ah, Peter, that is the point. Adding the colour and graphics to the standard OSC emails. Why aren't they there already. I know that there are contribs that do that, but why can't OSC do it as it is?

Share this post


Link to post
Share on other sites
Guest
Ah, Peter, that is the point. Adding the colour and graphics to the standard OSC emails. Why aren't they there already. I know that there are contribs that do that, but why can't OSC do it as it is?

Well that post came a cropper.

 

I am part way through installing a contrib to send html emails (have been since Xmas 2005). It is difficult to get it working correctly with the other contribs that have been installed (no this is not a cry for help). There is a new version that has come out this month, but it still has the problems of integratiing the features I want.

 

Other contribs require another editor, but I don't see why I need that for the standard emails.

 

I know the next release will do what I want, and I know that zen cart does it already.

 

All up, it is 2007 and still osc offers is text emails. Another issue is the invoice and packing slip. If only they could all be modernised at the same time.

Share this post


Link to post
Share on other sites

The standard osC emails, like the welcome email, use constants. You can always change those constants to format the email as you require.

 

The newsletters and emails you send from admin, will change everytime you send them. Therefore, ultimately, you will have to tell osC how you want them to appear. It doesn't matter which cart you have, this will be the case.

 

It isn't difficult writing a html email but if you're not comfortable with html, you could try something like TinyMCE, which as far as I know, turns any text area into a wysiwyg editor.

Share this post


Link to post
Share on other sites

×