This topic is locked

Mail Formatting

1/8/2013 9:25:15 PM
PHPRunner General questions
B
bleigh@yucatech.com authorDevClub member

Hi all,

I need to build an eblaster. I created a template file for eblasts. simple stuff, desc, subject, body. Rich text format on body. Can create some pretty nice eblast templates with basic editor.

I then insert button on "mail list" page. Mail list has names and email addresses on it. Server tab of button has this code:
global $conn;

$strSQLExists = "select from tblUsers where Userid = '".$_SESSION['UserID']."'";

$rsExists = db_query($strSQLExists,$conn);

$data2=db_fetch_array($rsExists);

if($data2)

{

$email_msg = "";

//$email_msg.= "List of records";

$i=1;

while($data = $button->getNextSelectedRecord())

{

$strSQLExists = "select
from tblEblasts where rcdid = ".$data["UseElbastTemplate"];

$rsExists = db_query($strSQLExists,$conn);

$data1=db_fetch_array($rsExists);

$email_msg = $data1["Body"];

$subject = $data1["Subject"];

$email= $data["Email"];

runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $email_msg, 'host' => $data2["EblastSMTPServer"], 'port' => 465, 'username' => $data2["EblastEmailAddress"], 'password' => $data2["EblastEmailPW"]));

}

}
which grabs all selected records fro list page and sends an email. This all works... problem is body sends raw html rather than formatted html text as email so i get email body like :
<b><font face="Arial, Helvetica, sans-serif" size="4">Lets all get together and celebrate Poodlery.</font></b><div><b><font face="Arial, Helvetica, sans-serif" size="4">
</font></b></div><div><img src="https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=20505&image=1&table=forumtopics"></div>;
rather than the formatted text and pics.
am new to runner so im not sure how to use the runner_mail function. i dont see in help text anywhere a "format" or mime directive to format html. Anyone have some advice?

Sergey Kornilov admin 1/9/2013

PHPRunner manual provides an example of sending HTML emails:

http://xlinesoft.com/phprunner/docs/runner_mail_function.htm
Here is also a tutorial on sending templated HTML messages:

http://www.asprunner.com/forums/topic/19089-sending-templated-email-messages/