Question

I have a webapp to send mails using PHPMailer. I have generated a url which needs to be concatenated with the body of the mail.

$url=$this->createUrl($route,$params); //creates url
$mail->Body = $url; // to concatenate with the body.
$mail->MsgHTML($_POST['Model']['body']); // not getting included

This "body" is getting over written with the "body" field of the page. How can I include the url in my email?

Was it helpful?

Solution

I do not exactly understand which one now overwrites the other one, but generally you could first concatenate the URL with the BODY and then assign it to the Email.

$url=$this->createUrl($route,$params); //creates url
$body = $_POST['Model']['body'] . $url; // concatenate body with url

$mail->Body = $body; // either this
$mail->MsgHTML($body); // or this (do not know which works for you)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top