Boris
Boris

Reputation: 8911

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

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 newlines
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!

Upvotes: 3

Views: 3848

Answers (1)

Alex
Alex

Reputation: 755

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?"

Upvotes: 1

Related Questions