I making a newsletter for my users and would like to send it using my php.
I use the mailer function which works fine. My problem is as follows.
the email does not appear as it should on gmail and hotmail and this only on the web version. If I use outlook or mail to view the email, then CSS is applied. but when i view the same email on the web, the css seems to be removed.
Any idea as to what I should be doing?
my second question is about the structure of the html email itself. should it have the html and body tags? or would just divs be enough?
would you recommend using tables for the layout, as i have noticed some newsletters using them? maybe that is a better alternative to floats ( for html email only)
Thank you for your help
E-Mail clients do not support the whole spectrum of HTML/CSS features that are supported by today’s web browsers.
See the following for further information:
Email Standards Project
Guide to CSS support in email clients
Gmail's web UI strips all <style> tags.
It should be a completely self sufficient html document with styling included and all paths (links/images/etc...) should be complete paths.
Related
I use a right to left language. When I send emails from my PHP script using phpmailer, the message body will be received (for example on my account of yahoo) left to right. Although I am using HTML message body and I've set the html tag direction right to left.
<html dir="rtl">
What can I do to overcome this issue?
HTML markup in Email Clients has to be supported by the Email Clients. If you are familiar with how differently IE and Firefox can display the same HTML, you will understand the chasm between different "browsers". Each email client is, yet another browser.
There are many articles, that discuss the markup that is allowed including this stackoverflow article.
That last one seems to indicate that the following will work:
<body style="text-align:right; direction:rtl;">
I have a cakephp Shell programme that send email to users but my in Yahoo email is fine but in gmail it looks bad.
Any help?
Thanks
The set of css rules supported varies greatly for different email clients. So to ensure consistent display you should use only those rules that are supported by all (or most) clients. You can check the list of css rules supported for popular emails client here https://www.campaignmonitor.com/css/
I am integrating AWS with my php website. I know how to send a simple text email to user.
But I want to send something formatted and images in that like this.
How can i send something like this using AWS(Amazon Web Service) ?
Is there documentation available on how to send this kind of an email?
Any Help would be appreciated.
Thanks In Advance.
I have done it using tables.
We can not use internal or external CSS in email. We can use the inline CSS. But in html email it's best to use tables.
I've just downloaded mail templates from MailChimp. But when I send them with PHP the html tag, headers and all css styles are removed when I view message in Gmail and mail is useless.
As far as I know I need to make css inline not in headers.
But it still confuses me why MailChimp offers such templates that does not work?
SOLUTION:
I've just found out that MailChimp offers CSS inliner tool. Nice.
When you send e-mail generated by your PHP to MailChimp through MailChimp API there is one parameter saying that you want to inline you CSS automatically by MailChimp. Otherwise headers are cutted out.
Well, I'm trying to create a newsletter, that will send emails to users in a database. The newsletter itself would draw "events" and other activities from a database. Whats the best way to take that list, and put them in an email? I was thinking about putting them into an html page, then sending an html email, but not all emails support html(like school email). What would your guys recommend? Could you point me to some good resources?
Also, this is for a school project, so I cant use any open source type stuff, unfortunately :(
You are correct in your assumption that if you are creating html newsletters, you will also have to do a text based version for clients that don't support html or ones that ask to have e-mail be sent only in text. You will need to make sure your code sends both versions to recipients. You could also ask the recipients for their preference and send them the specific version that they requested.
For html e-mail it is highly recommended to read the following two articles by CampaignMonitor (they specialize in e-mail marketing sofware):
HTML E-mail Design Guidelines
Guide to CSS support in email
clients
Note that I am assuming you are asking for help with the actual construction of the html for the email not the code needed to create and send the newsletter.
Good luck with your project.
==== UPDATE ====
So it seems that you actually need help in developing this project. Since this is a homework, I will provide some general advice that should steer you in the correct direction and get you started on the project. Then, if you have any specific problems with your code, you can ask about them on Stackoverflow.
There is really two things that need to be done here:
In PHP, dynamically contruct a variable that contains the html or text versions of the e-mail that needs to be sent.
Loop through your contact list and e-mail the contents of that variable.
Sending E-mail
I will start with the sending e-mail portion, because the links provide bellow also show you how to construct the message. Also, in your comment you said you already know how to contruct an html from a database. The following links show you two ways to send e-mail. You can either use the Mail function that comes with PHP or download the PEAR_Mail package. If you are allowed to use additional libraries and want to send html e-mail, I would recommend using the PEAR_Mail, because it makes things much easier if you want to send a both an html and text version of an e-mail together.
Note: To send an e-mail you will need to use some sort of mail server. If you are using Windows, you can install the SMTP service that comes with IIS or you can use an external smtp service such as google to send your e-mails.
http://www.w3schools.com/php/php_ref_mail.asp
http://us2.php.net/manual/en/function.mail.php
http://www.webcheatsheet.com/php/send_email_text_html_attachment.php
http://pear.php.net/manual/en/package.mail.mail.php
http://pear.php.net/package/Mail_Mime/docs
Construct E-mail
The complexity here will depend on whether you just want a plain text e-mail or html. For either case you will need to read the event data from your database and add it to the message that you want to send.
Some Seudocode:
Loop through datarows
message = DataRow[EventDate] + " " + DataRow[EventName] + "\n"
Loop through recipients
mail message
Hopefully this gives you a start. I would recommend getting php to send out an e-mail of a static html or text first. Once you have that code working you can start working on adding the functionality of reading event info from a database and sending it out.
Hope this helps.