(Swift) PHP Mailer class with plugin support

Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.

Moderator: General Moderators

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

Re: utf-8 support?

Post by Chris Corbyn »

akreider wrote:Does this have utf-8 support? I'm getting my software to work in unicode so that it will work in 99% of the world's languages.

I'm not sure if you'd want to build-in utf-8 support, or if there is something that programmers should be doing before they get the email text into your script?

I've read something about needing to convert the email text to base64... I guess I'd want to be able to have the email text, subject header, and to: header in unicode.
I can now confidently answer this question with "Yes".

2.1.0 includes a number of changes which all deal with unicode and other character encoding issues. I've had a number of developers try test this quite throroughly against various servers an clients with languages covering thai, danish, spanish and swedish. Thai was also tested with windows-874 encoding successfully.

Unless you specify otherwise using setCharset() Swift will automatically figure out if the email you're sending is UTF-8 or not.

The other change added apart from the encoding itself is to check for servers that support 8BITMIME and don't require the use of quoted-printable encoiding on top of the unicode. These servers will just take the unicode as is, the others will take it with QP encoding and the client decodes that again.

In a nutshell, UTF-8 is working great and you don't need to specify it ;)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

d11... I just used this for the first time today. WOW. Freakin sweet. This is SOO much better than PHPMailer. WAY above and beyond my expectations. Nice work!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The Ninja Space Goat wrote:d11... I just used this for the first time today. WOW. Freakin sweet. This is SOO much better than PHPMailer. WAY above and beyond my expectations. Nice work!
Heh, thanks :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

There are now Unit Tests included with Swift ... ermm... These are my first publically released units for anything before so feedback is good ;)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

FYI

Swift Mailer has been integrated into Symfony: http://www.symfony-project.com/trac/wiki/SymfonyPlugins (sfSwiftPlugin)

I believe there are plans to convert Symfony's sfMail to use Swift although following the Trac ticket for it seems have died thus far.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Since I'm guessing the SwiftMailer forum isn't one everybody flocks to I'd just like to draw your attention to a proposal and gather your thoughts:

viewtopic.php?t=58112 (Replies in the linked thread only please) :)
Martinez
Forum Newbie
Posts: 4
Joined: Tue Nov 07, 2006 2:06 pm

Attachments and Outlook and Outlook Express

Post by Martinez »

First of all thanks for the great library...

I am having a weird problem. I am sending emails with attachments.
(I used your example code as a base).

The attachments are not recognized by outlook or outlook express.

I bcc to myself (Mac Mail client) and I see the attachment fine.

Any thoughts on this...?

I let swift set the mime type (octet-stream) :

$mailer->addAttachment(file_get_contents($file), $this->current_doc);

Any help will be greatly appreciated.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Attachments and Outlook and Outlook Express

Post by Chris Corbyn »

Martinez wrote:First of all thanks for the great library...

I am having a weird problem. I am sending emails with attachments.
(I used your example code as a base).

The attachments are not recognized by outlook or outlook express.

I bcc to myself (Mac Mail client) and I see the attachment fine.

Any thoughts on this...?

I let swift set the mime type (octet-stream) :

$mailer->addAttachment(file_get_contents($file), $this->current_doc);

Any help will be greatly appreciated.
Create a thread in this forum and post the code in question :)
Post Reply