English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a web site that sends out a weekly newsletter to about 900 people. Right now the newsletter is plain text and the formatting doesn't seem to be consistent from one recipient to the next (I receive it at three different email addresses just so I can check the formatting).

I've played around with html emails before but I haven't been able to get it working right. If I hard code the html then it works fine, but if I try to base it on results of a query the message is just blank.

Can you can direct me to a good guide for creating/sending html email messages with PHP.

2007-09-25 17:44:20 · 2 answers · asked by Justin H 7 in Computers & Internet Programming & Design

2 answers

I'm doing the same thing (but to a much smaller distribution - my Sunday School class).

The way I solved this was to read in the source of the message to be sent from an .xml file. Since XML is a super-set of HTML, if I embedded the HTML version of the message in HTML, I'd have to laboriously parse the entire XML file. I'm lazy. The actual message is in a format called "Markdown" (http://daringfireball.net/projects/markdown/).

So, each section of my newsletter is an XML "section" with the actual text formatted in Markdown.

I read the XML in, process the Markdown and build both the "text" and "HTML" version of the message at the same time.

I then use a PHP script to actually send out the email using the phpmailer class. It reads in the distribution list, reads in both the "text" and "HTML" message bodies and sends them out. Works like a champ.

2007-09-25 17:58:16 · answer #1 · answered by Anonymous · 0 0

The question would desire to already be achieved at that ingredient. even though it possibly is conceivable to insert the two checklist making use of one question, there extremely is not any reason to do it. merely make it 2 queries, it makes a lot clearer code. and additionally you will desire to think of of why you're storing the e-mail handle at 2 distinctive places. you p.c. for to keep the comparable advice on merely on place indoors the database

2016-12-17 10:35:21 · answer #2 · answered by ? 4 · 0 0

fedest.com, questions and answers