开发者

C library for email composition with UTF-8 characters

I'm building a C app that must send email containing UTF-8 (accented) characters in the body. I found 285 related postings on stackoverflow but they don't address my specific questions:

  1. Is there a C library (not windows/platform specific) to help compose an email, then send by SMTP? (I don't want to just call a shell command from C). I found chilkat libraries but they look overwhelming.

  2. Is it possible to put UTF-8 characters into a plaintext email? If not, 开发者_C百科how would I send UTF-8 characters in the body?

  3. If I send an HTML based email body, does a plaintext version automatically get created (or is this a function of the mail client presenting the email to the recipient).

Thanks@


You didn't mention an operating system. the c-client library from ftp://ftp.cac.washington.edu/imap/ (called "imap" there) has function to encode mails and should work on different Unix flavors and Windows. Even though the version number says 2007 it's updated this year. The tarball contains some documentation. ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz


Simply put Content-type: text/plain; charset=utf-8 and Content-transfer-encoding: quoted-printable in the header (for the message or MIME part, depending on if you're using multiple MIME parts), and encode the byte stream of UTF-8 as quoted-printable (the ugly =XX stuff). There's nothing UTF-8-specific to be done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜