sending utf8 emails
Posted: Thu Jul 10, 2008 10:47 am
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?
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?