开发者

Sending an E-Mail via C# using mailto - Maximum length?

开发者 https://www.devze.com 2023-03-31 18:17 出处:网络
I would like to open the default E-Mail client and create an E-Mail for the user. The user then should just have to send it.

I would like to open the default E-Mail client and create an E-Mail for the user. The user then should just have to send it.

So far I use this code:

StringBuilder sb = new StringBuilder(lblLink.Text);
sb.Append("?subject=");
sb.Append(mProduct);
sb.Append("&body=");
sb.Append(Properties.Strings.MailBody);
sb.Append(GetFullText());

// Use Unicode newline开发者_StackOverflows
string mailText = sb.ToString();
mailText = mailText.Replace("\r\n", "%0d");

// Open E-Mail Editor
aMailApp.StartInfo.FileName = mailText;
aMailApp.StartInfo.UseShellExecute = true;
aMailApp.StartInfo.RedirectStandardOutput = false;
aMailApp.Start();

The problem with this approach is that the E-Mails body gets truncated after ~2000 characters. Is there any way to fix this?

Thanks!


If you are working in a MS Windows environment only you can maybe avoid this restriction by using the MAPI32.DLL.

Have a look at my previous post "How to send email using default email client?"

0

精彩评论

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