I'm just trying to find a way of sending an email with accented characters. My data is stored internally in utf8, but the set of characters I'm working with at the moment could be converted without loss to ISO-8859-15 or something similar.
From reading the comments on the mail() function documentation on php.net and other places, my understanding is that I need to choose a character encoding and a transfer encoding, convert my message into those encodings, and add a header to the message that declares those encodings.
The other thing I understand from the comments is that certain servers, clients, or spam blockers don't understand certain encodings. I'm worried about this, I'm sure some of the comments are out-of-date hearsay, but I don't have the time to test everything in the mail ecosystem, I'm just sending test messages to various mail accounts I have.
I've been fiddling around with various combinations of encodings. The most convenient transfer encoding is quoted printable, but the imap_qprint function isn't available on my production server, so for the moment trying to see if it'll work with ISO-8859-1 + binary transfer encoding.
Am I missing something simple here, or is mail() just not reliable enough for sending anything where it's important that a bill for £1000 isn't turned into a bill for =A31000 in transmission, or that "Dear Mr. O'Reilly" isn't turned into "Dear Mr A~Reilly"? In 2008, I want to be able to pass a message in a given encoding to mail(), and let it pick appropriate transmission formats. If I hear that some servers are fussy about encodings, the last thing I want to do is hand encode a message using something I've copied from a website.
If mail() doesn't cut it, what's the surest way of solving this? Should I ask to have the mb_ functions enabled on the server? Or should I try out something like Swift Mailer?
sending utf8 emails
Moderator: General Moderators
- vargadanis
- Forum Contributor
- Posts: 158
- Joined: Sun Jun 01, 2008 3:48 am
- Contact:
Re: sending utf8 emails
You can always build up an email but you must be familiar with the RFCs and MIME. Very much data...
Instead you should try using an emailer project such as phpmailer or swift mailer. Swift mailer is a project led by one of the "haupt-guys" of these forums. Mail is too simple...
Instead you should try using an emailer project such as phpmailer or swift mailer. Swift mailer is a project led by one of the "haupt-guys" of these forums. Mail is too simple...
Re: sending utf8 emails
Yes, and it's more than just implementing the RFCs, it's working around the idiosyncrasies of how various servers and clients in the ecosystem have implemented the RFCs. I've downloaded swiftmailer and I'll use it on the next project, or even on last week's problem if my solution of converting down to ISO-8859-1 and being restrictive about the characters I use turns out not to have worked.
- vargadanis
- Forum Contributor
- Posts: 158
- Joined: Sun Jun 01, 2008 3:48 am
- Contact:
Re: sending utf8 emails
Yup... Well it seems you know a fair amount about RFCs and mails. I know nothing about swift mailer, never used it but support the local guys! 