0

hi need some help with mailing. I'm trying to insert the content of this variable into a string to send as an email also need to add a newline. Also need to change From header to "Procity" and procitystaff@gmail.com

$claim_msg='Hey $claim_username, \n The donator has cancelled your claimed item, but you got your          '    $email_to=$claim_email;
$template=$claim_msg;
$subject= "Claimed item canceled";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1 '.' \r\n';
$headers .= 'From: procitystaff@gmail.com'.' \r\n';
$from='procitystaff@gmail.com';

mail($email_to,$subject,$template,$headers);     
  • Why not use the [actual PHPMailer package you tagged in](http://stackoverflow.com/tags/phpmailer/info)? – Wrikken Aug 14 '13 at 23:00
  • http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php – Sammitch Aug 14 '13 at 23:01

2 Answers2

1

You're missing a semi-colon before $email_to which would cause a syntax error.

You're also using single-quotes ' while inserting a php variable printing out Hey $claim_username as opposed to double-quotes " which would print Hey JohnDoe.

McAden
  • 13,714
  • 5
  • 37
  • 63
1

The semi-colon was missing at the end of the first line in the code below. Plus, I also used concatenates.

Give this a try. There will be a line break between the username and The donator.

Example:

Hey John,
The donator has cancelled your claimed item, but you got your

$claim_msg='Hey ' . $claim_username . ',' . "<br>\n" . 'The donator has cancelled your claimed item, but you got your';
$email_to=$claim_email;
$template=$claim_msg;
$subject= "Claimed item canceled";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1 '.' \r\n';
$headers .= 'From: Procity <procitystaff@gmail.com>' . "\r\n";
$from='procitystaff@gmail.com';

mail($email_to,$subject,$template,$headers); 
Community
  • 1
  • 1
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141