[SOLVED] Alternative Body

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
agidolor
Forum Newbie
Posts: 2
Joined: Tue Apr 24, 2007 1:35 am

[SOLVED] Alternative Body

Post by agidolor »

In phpmailer, there is a function to include an alternative body. I use this to include a plain text version of the Body intended for e-mail clients that do not support HTML. I cannot find this function in Swiftmailer; does a similar function exists? I saw an alternative solution by using the multipart feature of Swift, adding an html and text version as parts of the e-mail. I just hope there's a solution similar to phpmailer.

Below is the function in phpmailer:

$mail->Body = "<b>Sample</b>";
$mail->AltBody = "Sample Body";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Alternative Body

Post by Chris Corbyn »

agidolor wrote:In phpmailer, there is a function to include an alternative body. I use this to include a plain text version of the Body intended for e-mail clients that do not support HTML. I cannot find this function in Swiftmailer; does a similar function exists? I saw an alternative solution by using the multipart feature of Swift, adding an html and text version as parts of the e-mail. I just hope there's a solution similar to phpmailer.

Below is the function in phpmailer:

$mail->Body = "<b>Sample</b>";
$mail->AltBody = "Sample Body";
The link posted by feyd does the same thing in a more elegant/flexible manner. You can add as many parts as needed unlike with PHPMailer which only allows two parts.
agidolor
Forum Newbie
Posts: 2
Joined: Tue Apr 24, 2007 1:35 am

Re: Alternative Body

Post by agidolor »

Thanks for your help! :)
Post Reply