Jump to content
xisto Community
Chesso

Html Emails How?

Recommended Posts

How on earth do you create HTML emails?I have been searching Google for some time now and can find ABSOLUTELY no information what so ever on how to ACTUALLY create HTML content emails.It just a bunch of programs and Microsoft applications, or testing facilities, I don't need any of this, there must be some coding system to it?I tried emailing using basic direct HTML tags (like <b>), but it fails (it just shows <b>), so how can I do this?I am not looking for anything really fancy, I just want to use some basic bolding and font changes and things to make it look a little more professional and thought out.Can you use CSS also?There has to be a way, hopefully someone here knows lol.

Share this post


Link to post
Share on other sites

Oh and also here is what I use in PHP basically to send email:

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );

$mailto is the email to send to obviously (if that has an effect).

$subject is self explanatory.

$messageproper is the actual content of the message.

The last bit I assume are the headers (I think I got this bit from somewhere else), so I am unfamiliar exactly with what to do with the headers.

I found some information on HTML emails, with changing the headers to make it work, but then it left out anything of like what I have, which makes me wonder if the mails would still even work properly?

Share this post


Link to post
Share on other sites

It's all about the headers (or at least it should be), so take a look at this example at php.net: http://php.net/function.mail

Basically, you would just need to add these two header lines two your e-mail:

$headers  = '(anti-spam-(anti-spam-mime-version:)) 1.0' . "rn";$headers .= '(anti-spam-(anti-spam-content-type:)) text/html; charset=iso-8859-1' . "rn";

~edit~

The forum won't allow me to write this piece of code properly (due to anti-spam protection), so look for these two lines in the example.

Share this post


Link to post
Share on other sites

That looks to work just fine.It appears CSS does not work though, I have heard you can use Javascript and things, but I don't really need that.Is there any particular reason why it ignores CSS?

Share this post


Link to post
Share on other sites

It depends on the email client or webmail, some email clients doesn't allow images, html tags, javascript, css, it's all usually can be control by some Preferences of the Email Software you're using.. For example, Thunderbird can easily support CSS in HTML emails, I can't find an idea why it doesn't work, how are you using the CSS? in style tags or style="color: red"? Also, don't know how you're using them, it may need a right CSS header if you're linking to a CSS file on the web or things like that, as I remember it is: "(anti-spam-content-type:) text/css", if you're linking to it you could use PHP to send that header like this: <?php header("(anti-spam-content-type:) text/css");?>Nevertheless, it could be your Email client or Webmail which doesn't support CSS or CSS is disabled.

Share this post


Link to post
Share on other sites

What pyost says about using inline css to format the content of your messages to send it as an html email is correct.

 

You have two options to attach the styles that you want to use:

Using style direcly in your HTML tags like <p style="color: #f00">text in red</p> or

Using style in the HEAD of the document like: <style type="text/css">p { color: #f00; } </style>

Also, it is recommended that your message includes both versions of your email, in plain text and in html. And of course, remember to use the correct headers.

 

Best regards,

Share this post


Link to post
Share on other sites

I used inline CSS to create borders for a table (works under normal circumstances without fail).Both versions of my email? What do you mean, like send both at the same time (that makes no sense lol), these emails are just for me personally, not for anyone else.And for now they are only going into GMail, I am just trying to create a standard and (I know it's definitely for me) type of feedback email, so I know it's purpose and where all the information will be right away.Much like I would a HTML/CSS etc page.

Share this post


Link to post
Share on other sites

HTML emails suck...I mean, they take longer to download, they just pretty up the information meant to be conveyed in the email. So yes, if you MUST send HTML email for some insane reason, please, for the love of god, send it as plain-text also.Most people have no idea how annoying it is to try to read HTML formatted email with a text reader over a shell link via mutt :/

Share this post


Link to post
Share on other sites

And it won't take longer to send both.......Like I stated, it's for ME only, in only GMAIL, for my PURPOSES.Is it just me or do people seem to frequently skip pretty core details of my recently previous messages lol.

Share this post


Link to post
Share on other sites

I am currently also figuring out my website on sending HTML emails and I've read that the header is the key part to changing it into HTML email. And a question for CSS, can you link up a file from my webserver and point it to those emails sent out?

<link href="http://forums.xisto.com/no_longer_exists/; rel="stylesheet" />

As I know that for images to display in HTML emails, I've to store those images in my webserver and link those in my HTML emails. If that's possible, then linked CSS can save quite abit of redundant codes compared to inline CSS.

Share this post


Link to post
Share on other sites

Both versions of my email? What do you mean, like send both at the same time (that makes no sense lol), these emails are just for me personally, not for anyone else.

I mean to send your email in HTML format and in plain-text format at the same time, but you don't need this, as you say, you only want the html version, so you only need to setup the headers as posted before.

 

If you need more information about this check this articles:

Campaign Monitor - A Guide to CSS Support in Email

Xaview Frenette - CSS support in HTML emails of Hotmail, Yahoo! Mail and Gmail

A List Apart - CSS in Email, Kissing in a Tree

How To Code HTML Email Newsletters (All New Version)

Sending HTML + text emails in PHP

BTW, from the last one you can download a complete php script for sending HTML emails.

 

Best regards,

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

×
×
  • 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.