line breaks in text message

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
hikaristeven
Forum Newbie
Posts: 5
Joined: Sat Feb 02, 2008 9:56 am

line breaks in text message

Post 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... ;)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: line breaks in text message

Post by Chris Corbyn »

Shouldn't those be double quotes? ;)
hikaristeven
Forum Newbie
Posts: 5
Joined: Sat Feb 02, 2008 9:56 am

Re: line breaks in text message

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: line breaks in text message

Post 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 :)
Post Reply