Howto send html based E-mail with php

Submitted on: 1/1/2015 9:50:00 AM
By: Peter Rekdal Sunde (from psc cd)  
Level: Beginner
User Rating: By 6 Users
Compatibility: PHP 3.0, PHP 4.0
Views: 1502
     Teaches you howto send html based E-mail with php


How to send mime enchased content (html) by E-mail. (Windows/Linux/UNIX).

This howto covers how you can send html based E-mail(s) by using php.
When I started out with php, one of the first things I wanted to learn was how
to send html based (E-mail) to my friends. I’m not going to bother you with
my life experience with php, so let’s start.

Content: (what this howto covers).


When I first started programming php, I thought you needed to have many packages/software installed on your computer to run all features that comes with php.
Well you don’t, all you need is, php3, apache and a mysql engine (optional).
If you already have php and apache installed, then you can scroll down to read the rest of this howto. If you don’t got the software/packages mentioned above, then you need to install them.

I’ll skip the boring part, and I’m assuming you have some php knowledge.

You can download this file as an example.
After you've downloaded this file, you extract it into your htdocs/ folder or whatever folder you may use as your default webcontent excutable folder.
1.Does my friends/users E-mail client accept all html code?
Unfortunately, not all E-mail clients can view html code.
Ie, Microsoft Outlook 6.0 can’t view Macromedia Flash code.
But that’s another thing.

2. Can I put all kinds of html inside the body tag?
Yes, you can but remember not to have any “” (quotes) inside the $body tag.
If you’re html contains “” (quotes) you need to replace them.
Ie, $body = “"my link.php" this is my link”;
That will generate an error in the php engine.
But if you replace it with $body = “\my link.php\ this is my link”; then php engine will accept it. The current function is called (“stripslashes”);

This bad howto was written by Peter Rekdal Sunde aka Exion.
I created this howto within an 30 minutes.
I realize that it is full of “bad spellings” but I don’t care because you can still learn from it.

Other 3 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.