This topic is locked
[SOLVED]

 customize emails

2/23/2012 5:56:05 AM
PHPRunner General questions
W
wundebar author

Hi at all!

I would like to know if is possible customize emails using phpmailer, in particular i would like to know if the field "subject" can contain a single data from the field of database.

For example if i have into my database fields like: City, country, ecc.. may i customize email with phpmailer in such way that allows me to send just the filed "City" into the subject of the mail and the other fields into the body of the mail?

I'm not so good with php script, some help?

Thanks! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=19083&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

W
wundebar author 2/23/2012



Check this article: http://xlinesoft.com/phprunner/docs/send_an_email_with_old_data.htm


Hi cristian!

Thanks for reply, i'm already using this code of phprunner, that's mine



foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$body.= $field." : ".$value."\r\n";

}


where "$body" is used by phpmailer, and allows to see the values of the array into the body of the email.

What i would like to know is if it's possible ( if phpmailer allow to do it) send just one value stored into the database (a specific field) into the field mail "subject". I hope i was more clear. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=64517&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />

Thanks again.

C
cgphp 2/23/2012
foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$body.= $field." : ".$value."\r\n";

}
$subject = $values['the_field_name_here'];
...

...

...
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $body, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
W
wundebar author 2/23/2012


foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$body.= $field." : ".$value."\r\n";

}
$subject = $values['the_field_name_here'];
...

...

...
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $body, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];



Ok i solved with this code

$mail->Subject = $values ['field name'];


unfortunately phpmailer don't run with this code

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $body, 'from'=>$from));


i don't know why!

Anyway thanks for help.

A
ant 2/28/2012

I been struggling with emails, this code works for me. Hope it helps...
$email=$data["email"];

$from="admin@test.com";

$msg="";

$subject=$values['field_name']."\r\r\n";
foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$msg.= $field." : ".$value."\r\n";

}
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];