c# - asp.net mvc 4 letter from site encoding -
i have feedback form on mvc site, need send form email.
want test form, save mailmessage object disk *.eml file
[httpget] public actionresult contacts() { feedbackform temp = new feedbackform(); temp.message = @resources.global.contacts_form_message_field; return view(temp); } [httppost] public actionresult contacts(feedbackform model) { mailmessage msg = new mailmessage(); msg.bodyencoding = encoding.utf8; msg.from = new mailaddress(model.email, @resources.global.contacts_form_email_title); msg.to.add("tayna-anita@mail.ru"); string message = @resources.global.contacts_form_name_field + ": " + model.name + "\n" + "email: " + model.email + "\n" + @resources.global.contacts_form_phone_field + ": " + model.phone + "\n\n" + model.message; msg.body = message; msg.isbodyhtml = false; smtpclient client = new smtpclient("mysmtphost"); client.deliverymethod = smtpdeliverymethod.specifiedpickupdirectory; client.pickupdirectorylocation = @"c:\test"; try { client.send(msg); } catch (exception ex) { } feedbackform tempform = new feedbackform(); tempform.message = @resources.global.contacts_form_message_field; return view(tempform); }
and get:
x-sender: "letter site" <sssssss@mail.ru> x-receiver: tayna-anita@mail.ru mime-version: 1.0 from: "letter site" <sssssss@mail.ru> to: tayna-anita@mail.ru date: 21 may 2013 16:57:55 +0400 content-type: text/plain; charset=utf-8 content-transfer-encoding: base64 tmftztogdgvzdcb0zxnzc3nzdapfbwfpbdogc3nzc3nzc0btywlslnj1clbob25loia4 otiwodcxmza2mqokw2f1xsbdag9py2vzichjb25mawrligluig1lksatighhcnzlesb4 ig1pa2ugw2f1xsbdag9py2vzichjb25mawrligluig1lksatighhcnzlesb4ig1pa2vb yxvdienob2ljzxmgkgnvbmzpzgugaw4gbwupic0gagfydmv5ihggbwlrzq==
why body of letter looks in way ?
i send letters site in english , in russian , set msg.bodyencoding = encoding.utf8;
.
what should don't have problems encoding?
what you're seeing message encoded base-64. can see email header:
content-transfer-encoding: base64
presumably, opening message in plain-text editor, email content not being decoded.
if decode message using base64 decoder (which email client automatically), following:
name: test tessssst email: sssssss@mail.ru phone: 89208713061
[au] choices (confide in me) - harvey x mike [au] choices (confide in me) - harvey x mike[au] choices (confide in me) - harvey x mike
Comments
Post a Comment