dinhvh / libetpan

Mail Framework for C Language
www.etpan.org
Other
612 stars 283 forks source link

Is there Some Example Code to Parse Email Header and Attachment? #24

Closed irishcoffe36 closed 12 years ago

irishcoffe36 commented 12 years ago

I have read the Example Code in Tests Directory. but i still don't understand How to Pase Each Part of a EMail. For Example, I have got the EMail Message Content in data of bytes. How do I get the Subject,From,Receiver,and Attachment Part From the data? I Notice there was a Example Code called Parse-MIME in Tests Directory. but it seems too hard for me to understand and use. could anyone supply me some sample code to parse each part of a Email?

dinhvh commented 12 years ago

You can have a look at mime-parse.c

notmmao commented 12 years ago

How encode&&decode of MIME header values?

at mime-create.c : line: 58,

mb = mailimf_mailbox_new(strdup("DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?="), strdup("dinh.viet.hoa@foobaremail.com"));

I do not know the "DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?=" means.

dinhvh commented 12 years ago

encode MIME headers value: https://gist.github.com/1513827

decode MIME headers value: https://gist.github.com/1513831

DINH Viêt Hoà Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Friday, December 23, 2011 at 11:18 AM, notmmao wrote:

How encode&&decode of MIME header values?

at mime-create.c : line: 58,

mb = mailimf_mailbox_new(strdup("DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?="), strdup("dinh.viet.hoa@foobaremail.com (mailto:dinh.viet.hoa@foobaremail.com)"));

I do not know the "DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?=" means.


Reply to this email directly or view it on GitHub: https://github.com/dinhviethoa/libetpan/issues/24#issuecomment-3259637

irishcoffe36 commented 12 years ago

I do not know the "DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?=" means.

DINH --I do not know the Word means also. May be somebody's Name? "=?iso-8859-1?Q?Vi=EAt_Ho=E0?=" -- This Is Some Short Message Encoding by Quoted-printable and Use iso-8859-1 character. this form of short message often Consists of three parts"=?Character?Encoding?Encoded Text?=". it often uses in EMail's Subject and Attachment File Name.

2011-12-24

西安翼展电子科技有限公司

杨少光/研发部

Moblie:15829399454 Web: www.hypacs.com Email:yangshaoguang@hypacs.com Add:西安市高新区科技路48号创业广场A座608室 Post:710075

发件人: notmmao 发送时间: 2011-12-23 18:19:01 收件人: irishcoffe36 抄送: 主题: Re: [libetpan] Is there Some Example Code to Parse Email Header and Attachment? (#24)

How encode&&decode of MIME header values? at mime-create.c : line: 58, mb = mailimf_mailbox_new(strdup("DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?="), strdup("dinh.viet.hoa@foobaremail.com"));

I do not know the "DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?=" means.

Reply to this email directly or view it on GitHub: https://github.com/dinhviethoa/libetpan/issues/24#issuecomment-3259637

dinhvh commented 12 years ago

Please read RFC 2047 (http://tools.ietf.org/html/rfc2047). That should help you understand headers encoding.

DINH Viêt Hoà Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Saturday, December 24, 2011 at 1:42 AM, irishcoffe36 wrote:

I do not know the "DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?=" means.

DINH --I do not know the Word means also. May be somebody's Name? "=?iso-8859-1?Q?Vi=EAt_Ho=E0?=" -- This Is Some Short Message Encoding by Quoted-printable and Use iso-8859-1 character. this form of short message often Consists of three parts"=?Character?Encoding?Encoded Text?=". it often uses in EMail's Subject and Attachment File Name.

2011-12-24

西安翼展电子科技有限公司

杨少光/研发部

Moblie:15829399454 Web: www.hypacs.com (http://www.hypacs.com) Email:yangshaoguang@hypacs.com (mailto:yangshaoguang@hypacs.com) Add:西安市高新区科技路48号创业广场A座608室 Post:710075

发件人: notmmao
发送时间: 2011-12-23 18:19:01
收件人: irishcoffe36
抄送:
主题: Re: [libetpan] Is there Some Example Code to Parse Email Header and Attachment? (#24)

How encode&&decode of MIME header values? at mime-create.c : line: 58,
mb = mailimf_mailbox_new(strdup("DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?="), strdup("dinh.viet.hoa@foobaremail.com (mailto:dinh.viet.hoa@foobaremail.com)"));

I do not know the "DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?=" means.

Reply to this email directly or view it on GitHub: https://github.com/dinhviethoa/libetpan/issues/24#issuecomment-3259637


Reply to this email directly or view it on GitHub: https://github.com/dinhviethoa/libetpan/issues/24#issuecomment-3265865

notmmao commented 12 years ago

Understood, thanks for the clarification.

And in mailmime_write_mem.c, I found the mailmime_quoted_printable_write_mem function can be completed the task--Encode MIME headers.