PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Jun 25, 2019 6:00 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: base64 Encoding
PostPosted: Mon Jan 24, 2011 4:50 am 
Offline
Forum Newbie

Joined: Mon Jan 24, 2011 4:44 am
Posts: 2
Hi,

Firstly I luv this library, certainly it makes life a lot easier.

Question: How do you encode using base64? I notice the code has the capability but I cannot see any doc on how to do it. The doc in these forums is a bit out of date (i.e $message->headers->setEncoding("B") doesn't work).

The reason I am asking is because the 78 char line split is causing issues in some readers. If the split occurs in the middle of a html attribute some email readers don't like it. I tried this $message->setMaxLineLength(1000); but that didn't work either. It still split at 78 chars.

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: base64 Encoding
PostPosted: Mon Jan 24, 2011 6:24 am 
Offline
Forum Newbie

Joined: Mon Jan 24, 2011 4:44 am
Posts: 2
Sorry to bother you but I ended up figuring this out. Here is waht I did just in case someone else has this problem;

Syntax: [ Download ] [ Hide ]
$message = Swift_Message::newInstance();
$message->setEncoder(Swift_Encoding::getBase64Encoding());
/*
 * Set up your text/plain body here
 */

$message->setBody($myTextPlainBody);
/*
 * Set up your text/html body here
 */

$htmlPart = Swift_MimePart::newInstance($myHtmlBody, 'text/html', null);
$htmlPart->setEncoder(Swift_Encoding::getBase64Encoding());
$message->attach($htmlPart);
 


If this is not right then please let me know.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group