mailmessage

Is there a way to serialize a .Net MailMessage object

I am trying to write a proc that will take in as a parameter a MailMessage object, and the split it apart to store the subject, body, to addresses, from address, and attachments (the hard part) in a database so the email can be sent at some point in the future. My first take on this was to rip out the parts I need and store them in a da...

sendAsync() does not send mail always in asp.net

Hi I am not able to send asynchronous mail in asp.net using c# .Though my code is correct as If I try to send mail 10 times then only of 1 time it is successful,rest of 9 times there is no error message but mail is also not sent at its destination.I am sending data in mail attachment. I want to send a file upto 5MB in size . Any typ...

How to suppress email validation when using SmtpClient and MailMessage

When sending out emails using the SmtpClient and a MailMessage (.net 3.5) the "To" email address(es) get validated prior to sending. I've got a big stack of email addresses which have a dot (.) before the at-sign, causing a FormatException when you attempt to send the message using the SmtpClient. This is actually a good thing, because b...

.NET: Problems creating email attachment from MemoryStream.

Hi all I'm using the following method to create an attachment from a MemoryStream: public void AddAttachment(Stream stream, string filename, string mimeType) { byte[] buffer = ((MemoryStream) stream).GetBuffer(); Attachment attachment = new Attachment(stream, filename, mimeType); _mail.Attachments.Add(attachment); } Note that t...

How can I attach a PDF file stored as binary object in SQL Server to an email?

I'd like to attach a PDF file stored as binary object in SQL Server to an email but without creating a (temporary) file on disk. I already have the first step to pull out the PDF file from the binary field in SQL Server as a byte[] array. Also I have the step to setup the MailMessage: MailMessage aMailMessage = new MailMessage(); // s...

System.Net.Mail.MailMessage "Reply-To" header is ignored in IIS 6.0 but OK in IIS 5.1

I have a web app project developed and unit-tested on a WinXP machine (IIS 5.1). It has been published to a Win2003Server (IIS 6.0). One feature of the app sends an email with a "Reply-To" header (snippet follows). On the IIS 5.1 machine, the Reply-To appears properly in the header. When sent from the IIS 6.0 PC, the header does not cont...

Sending to multiple Email addresses but displaying only one C#

Hi, I am using the SmtpClient in C# and I will be sending to potentially 100s of email addresses. I don't want to have to loop through each one and send them an individual email. I know it is possible to only send the message once but I don't want the email from address to display the 100s of other email addresses like this: Bob Hope...

WCF serializing error

Please help me with this WCF error....How do I handle these builtin classes for WCF? Type 'System.Net.Mail.MailAddress' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documenta...

Setting encoding for every part of a MailMessage

I'm targeting a .NET application for the international market and need to implement mail sending functionality. I've noticed on the MailMessage class there are several options for setting encoding: BodyEncoding SubjectEncoding HeadersEncoding To, From address encoding I have added a drop-down in the app's config page to choose the ma...

ASP.NET Send .htm file as email template

Hi can you send a .htm file as the html template using the mailMessage class? I cant seem to work out how to do it? ...

SMTP Authentication with config file's MailSettings

I'm storing my MailSettings in a web.config, however when I send the message, my SMTP server reports back that I need to use authentication. I've got my username/password in the config file, but it still fails. It works if I do the following, but it seems like an extra step. Shouldn't it just take it from the config file and use authent...

HTML email not displaying correctly

i have a strange problem with sending HTML mail in c#. Basically i am trying to email myself the weather every morning and I begin by downloading the weather in HTML markup from an ftp site. After obtaining the source file i then read it into a string and create a mailMessage using the following code. string body = File.ReadAllText(@"...

Is there anyway to display Right To Left plain text mails?

Hi, I'm sending mails in c# using SmtpClient. i'm sending the mails as plain text: message.IsBodyHtml =False; how can I send them as RTL? with HTML mails it's very easy-just tag them as RTL. Sample code: public void SendEmail(bool isJapanese) { try { MailAddress from = new MailAddress(FromEmail,Fr...

Using html page as mail body in asp.net

I have an email template in a file called template.html, how can i use it as mail body in asp.net? ...

MailMessage sent string as body without newline in outlook

HI, I am trying to send a simple notification using system.net.mail.mailmessage. I just pass the string as the message body. But problem is even though multi-line message been send have the correct "\r\n" format info in string. The mail opened in outlook will displayed as a long single line. But view source in outlook will display the me...

file attachment form c#

hi, im creating a web form that requires a user to uplaod a file in doc,docxorpdf format on submit the form gets posted to an email address along with the attached file, ihave successfully implemented the posting of form to the email address but don't know how to attach the file with it ... plz help public void ProcessRequest(HttpConte...