Page 1 of 1

line breaks in text message

Posted: Wed May 21, 2008 2:44 am
by hikaristeven
hello
as a conent user, this time i use swiftmailer for the first time with a simple text-message like this
(i've done attahcments in jpg, pdf, word,... html massmail... but never this simple textmail)

$body ='Geachte klant,\n';
$body .='Wij danken U voor Uw on-line bestelling en zullen deze met alle spoed verwerken.\n';
$body .='Alle bestellingen voor 14u zullen nog de dag zelf worden behandeld.\n \n';
$body .="Opmerking door U ingegeven:\n";
$body .= stripslashes($_POST["msg"]);

$message->attach(new Swift_Message_Part($body));

the mail gets send, but doesn't get broken into the lines i want where i put the \n :banghead:
doesn't the \n work?
and what is the solution then...????????????

thanks
mille grazie
merci bien
gracias

Steven
ps Chris another donation is coming your way, if this works... ;)

Re: line breaks in text message

Posted: Wed May 21, 2008 7:42 am
by Chris Corbyn
Shouldn't those be double quotes? ;)

Re: line breaks in text message

Posted: Thu May 22, 2008 12:33 pm
by hikaristeven
thanks a lot
i didn't know there was such a big difference in string variables using ' instead of "
do you have an explanation???
Is it specifically because of swiftmailer or for the whole php-world?

when the client pays
you will notice :wink:

good weekend
Steven

Re: line breaks in text message

Posted: Thu May 22, 2008 6:51 pm
by Chris Corbyn
In PHP single quotes are literal and double quotes are not. That means that variable names and escape sequences do not get interpreted in single quotes ;) Thanks for being generous :)