Jump to content
xisto Community
Sign in to follow this  
wild20

How Do I Send An Html Newsletter? Please help

Recommended Posts

I am trying to start a newsletter, and would like to know how you do it. I have the template, but if I send the html code, it send the html code. How to I put it in an email so you can actually view it? I tried one where they said put it so it is

HTML = HTML
, but it didn't work. Could someone please help me out here? Thanks.

Share this post


Link to post
Share on other sites

To allow html emails, you have to use the correct headers on the form. Google on multi-part form headers. I forget the exact header to send, but it is relatively simple enough to do. When I get home, I'll have a look to see the correct format and post it here.

Share this post


Link to post
Share on other sites

Thank you Jim! I can honestly say, with the help you guys have been giving me. Trap is awesome. You guys are so cool. Thank you for all your time. If you could get that to me, I would appreciate it so much. You have done a lot and I would love it if you would give me your site URL and if it is clean, I really want to link to it. Thanks guys!

Share this post


Link to post
Share on other sites

The mail() has three required parameters. ($to, $subject, $body) and a fourth ($from_header) is reccomended.
In order to send the email as an html document, the fourth parameter has to set the MIME type as text/html as follows:

$add_header = 'MIME-VERSION; 1.0n';$add_header .= '(anti-spam-content-type:) text/html; charset=iso-8859-1n";

So, for example, the correct code would then become:

mail($to, $subject, $body, $from_header . $add_header);

where the $to, $subject, $body, $from_header are previously set as per a regular text email. Note that the $add_header is concatenated to the $from_header inside the mail function in this example. It could be concatenated outside the function also, if you desire.

Share this post


Link to post
Share on other sites

Hmm. I am a little confused. Maybe you could clarify one thing. If I wanted to send a html code that was:

<head></head><body bgcolor="red"><p>This is a test</p></body>
Then how would I integrate those exactly. Could you take what you just showed me and put it into how it would look with my code. It will be longer and better, and much nicer. So don't worry :lol:

Share this post


Link to post
Share on other sites

Okay, something like this would work using the example you provide:

$body = "<head>n";$body .= "</head>n";$body .= "<body bgcolor="red">n";$body .= "<p>This is a test</p>n";$body .= "</body>n";
What this does is concatenant the "body" of the message into the variable named $body, complete with newline characters at the end of each line. Notice that the double quotes must be escaped. Then continue with the rest of the parameter variables like this:
$to = "your_list_member_email@example.com";$subject = " as per usual";$from_header = "your_email@example.com";

Lastly, the example given above to output the 4 parameters using the mail() function:
$add_header = 'MIME-VERSION; 1.0n';$add_header .= '(anti-spam-(anti-spam-(anti-spam-content-type:))) text/html; charset=iso-8859-1n";mail($to, $subject, $body, $from_header . $add_header);
At least I think that will work. Won't be far off. Post back here if you need any more assistance.

Share this post


Link to post
Share on other sites

Hmm. Only one more thing. I don't want the newslette to be sent out automatically. I want it sent to people I specify. So the command sending it to my list is useless. All I realy want is to be able to open my mail account at Cpanel, type in the people's name or list name myself, and then send it out. It look like this is PHP to me. Is there a way just to insert the html code into the body text area of a message, like gmail? If not, then what does this code do and where do I put it? As you can see, I am quite an amatuer, and would go sp far as to say coding and/or newsletter building illiterate.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.