Reputation: 17
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);
Upvotes: 0
Views: 88
Reputation: 74220
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
.
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);
Upvotes: 1
Reputation: 13970
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
.
Upvotes: 1