<?php
//This is the location of your sendmail variable
$mail_path = "/usr/sbin/sendmail -i -t";
//The email address to be receiving emails from this form
$mail_to = $email1 . ','. $email2;
//the subject of the email sent by the form
$mail_subject = "Confirm email";
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ABC\r\n";
$headers .= "Reply-to: contact@mycom.com\r\n";
$headers .= "Bcc: logs@mycom.com\r\n";
//the name of the buisness or website that the form contacts
$message = "<html><head></head><body>";
$message .= "<p>Dear $name, <br /> <br /> Your order is successfully created. <br />".
"Please go to the following link to track the status of your order: <br />".
"<br /><a href='http://www.mycom.com/cgi-bin/ordtrk.php?ordnum=$order_num'>
http://www.mycom.com/cgi-bin/ordtrk.php?ordnum=$order_num
</a><br /><br />".
"Thank you.";
$message .= "</body></html>";
//ini_set("sendmail_from", $mail_from);
ini_set("sendmail_path", $mail_path);
if( mail($mail_to, $mail_subject, $message, $headers) )
{
echo 'Email was sent to' . $email;
}else{
echo "There was an error in the email address";
}
?>
The general format of a multipart MIME message will be the following:
---------------- Begin -------------------
To: whoever@someplace.com
Subject: MIME test
Content-type: multipart/mixed; boundary="theBoundaryString"
--theBoundaryString
Plain text message goes in this part. Notice that it
has a blank line before it starts, meaning that this
part has no additional headers.
--theBoundaryString
Content-Type: text/html
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-Base: "http://somewebsite.com/"
<body><font size=4>This</font> is a
<i>test</i>.
--theBoundaryString--
---------------- End -------------------
Notice each of the blank lines above. Each one is important because it separates the header from the body in each part of the multipart document. First, the standard email headers are listed. The string theBoundaryString is used to separate each part of the multipart document. For the plain text area, there are no additional headers. Thus, it simply has a blank line before the actual content starts. After that, the HTML file with its headers starts.
The an important header there is Content-Base. It specifies the relative address for links within the HTML document. In other words, the following hyperlink:
<a href="apage.html">
will be interpreted relative to http://somewebsite.com/. Therefore, its full URL is:
http://somewebsite.com/apage.html
If you use full URLs in the HTML document, then there will be no need to specify Content-Base. For more information on this, see RFC 2110.
No comments:
Post a Comment