This topic is locked

How to Send HTML email

2/3/2010 11:05:40 AM
PHPRunner Tips and Tricks
M
marketingsolutions author

On using the trial version today, I wanted to be able to send out HTMl emails to clients once they had agreed our terms of contract.
I looked though the forum but could not find a full answer, so to help out anyone else searching, below you will find what you need to enter into
Events >> Add Page >> After record added



$to = "email@address.com";

$subject = "Subject Line Goes Here";
$message = "

<html>

<head>

<title>Title Line Goes Here</title>

</head>

<body>

<table width=\"778\" border=\"0\" cellspacing=\"10\" cellpadding=\"10\" style=\"border:1px dashed #DFF2F6;\">

<tr>

<td>

<h2>Email Page Title Goes Here</h2>
<p>I <strong>".$values["name"]."</strong> representing <strong>".$values["Companyname"]."</strong> confirm I have read and understood and agree to these terms of payment and wish for you to start work on this project.</p>

<p> I have received and will pay the invoice for the project value in order to action the contract.</p>

<p> I understand that work will commence on this contract once payment has cleared.</p>

<table border=\"0\" width=\"600\" cellspacing=\"10\" cellpadding=\"0\">

<tr>

<td valign=\"top\">Address:</td>

<td valign=\"top\">".$values["address"]."</td>

</tr>

<tr>

<td valign=\"top\">Signed: </td>

<td valign=\"top\">".$values["signed"]."</td>

</tr>

<tr>

<td valign=\"top\">Name: </td>

<td valign=\"top\">".$values["name2"]."</td>

</tr>

<tr>

<td valign=\"top\">Position: </td>

<td valign=\"top\">".$values["position"]."</td>

</tr>

<tr>

<td valign=\"top\">Date:</td>

<td valign=\"top\">".$values["datetime"]."</td>

</tr>

</table>
</td>

</tr>

</table>

</body>

</html>

";
// Always set content-type when sending HTML email

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers

$headers .= 'From: email@address.com' . "\r\n";

mail($to,$subject,$message,$headers);


I hope this helps.
If any code is wrong in this then please let me know

P
Pavel Nefyodov 2/4/2010

Please try this code in PHPRunner 5.1:



$email="your.email@your.com";// your email, please change

$msg="";

$msg.="<html>

<head>

<title>Title Line Goes Here</title>

</head>

<body>

<table width=\"778\" border=\"0\" cellspacing=\"10\" cellpadding=\"10\" style=\"border:1px dashed #DFF2F6;\">

<tr>

<td>

<h2>Email Page Title Goes Here</h2>



<p>I <strong>".$values["name"]."</strong> representing <strong>".$values["Companyname"]."</strong> confirm I have read and understood and agree to these terms of payment and wish for you to start work on this project.</p>

<p> I have received and will pay the invoice for the project value in order to action the contract.</p>

<p> I understand that work will commence on this contract once payment has cleared.</p>

<table border=\"0\" width=\"600\" cellspacing=\"10\" cellpadding=\"0\">

<tr>

<td valign=\"top\">Address:</td>

<td valign=\"top\">".$values["address"]."</td>

</tr>

<tr>

<td valign=\"top\">Signed: </td>

<td valign=\"top\">".$values["signed"]."</td>

</tr>

<tr>

<td valign=\"top\">Name: </td>

<td valign=\"top\">".$values["name2"]."</td>

</tr>

<tr>

<td valign=\"top\">Position: </td>

<td valign=\"top\">".$values["postion"]."</td>

</tr>

<tr>

<td valign=\"top\">Date:</td>

<td valign=\"top\">".$values["datetime"]."</td>

</tr>

</table>
</td>

</tr>

</table>

</body>

</html>

";
$subject="Confirmation";
$from="admin@test.com";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $msg, 'from'=>$from));// Note 'htmlbody' instead of 'html'!

if(!$ret["mailed"])

{echo $ret["message"];}



P.S. Please do check spelling. "$values["postion"]" doesn't look right to me.

N
ninemins 2/9/2010

Thanks guys was this code workin and verified
Cheers Chris



Please try this code in PHPRunner 5.1:



$email="your.email@your.com";// your email, please change

$msg="";

$msg.="<html>

<head>

<title>Title Line Goes Here</title>

</head>

<body>

<table width=\"778\" border=\"0\" cellspacing=\"10\" cellpadding=\"10\" style=\"border:1px dashed #DFF2F6;\">

<tr>

<td>

<h2>Email Page Title Goes Here</h2>
<p>I <strong>".$values["name"]."</strong> representing <strong>".$values["Companyname"]."</strong> confirm I have read and understood and agree to these terms of payment and wish for you to start work on this project.</p>

<p> I have received and will pay the invoice for the project value in order to action the contract.</p>

<p> I understand that work will commence on this contract once payment has cleared.</p>

<table border=\"0\" width=\"600\" cellspacing=\"10\" cellpadding=\"0\">

<tr>

<td valign=\"top\">Address:</td>

<td valign=\"top\">".$values["address"]."</td>

</tr>

<tr>

<td valign=\"top\">Signed: </td>

<td valign=\"top\">".$values["signed"]."</td>

</tr>

<tr>

<td valign=\"top\">Name: </td>

<td valign=\"top\">".$values["name2"]."</td>

</tr>

<tr>

<td valign=\"top\">Position: </td>

<td valign=\"top\">".$values["postion"]."</td>

</tr>

<tr>

<td valign=\"top\">Date:</td>

<td valign=\"top\">".$values["datetime"]."</td>

</tr>

</table>
</td>

</tr>

</table>

</body>

</html>

";
$subject="Confirmation";
$from="admin@test.com";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $msg, 'from'=>$from));// Note 'htmlbody' instead of 'html'!

if(!$ret["mailed"])

{echo $ret["message"];}



P.S. Please do check spelling. "$values["postion"]" doesn't look right to me.

M
marketingsolutions author 2/9/2010

I have this working with no problems on my system

A
alandob 2/9/2010

How can you send these HTML emails if you need SMTP authentication.
I use windows server 2003 with XAMPP (MySQL, PHP, PEAR, Perl with mod_perl & Apache) and need to send emails with SMTP Authenticaton. I have read some of the previous postings with details how to use with PEAR but the settings using XAMPP now do not have the same file settings (the posts may be outdated now http://www.asprunner.com/forums/topic/11773-e-mail/pagehlPEARfromsearch1) for example XAMPP doesnt have class.phpmailer.php & class.smtp.php files now.
Any help would be appreciated.