Questions tagged [system.net.mail]

System.Net.Mail is a namespace of the .NET framework. It contains classes used to send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery.

System.Net.Mail is a namespace of the .NET framework. It contains classes used to send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery.

References

290 questions
90
votes
2 answers

MailMessage, difference between Sender and From properties

I've been using the System.Net namespace ever since we switched from .NET Framework 1.1 to the 3.5 framework, but there’s one thing that’s been puzzling me since. What's the difference between the Sender and the From properties in the MailMessage…
Freek Buurman
  • 1,279
  • 1
  • 9
  • 15
70
votes
10 answers

Send SMTP email using System.Net.Mail via Exchange Online (Office 365)

We are testing the new Office 365 beta, and i have a mail account on the Exchange Online service. Now I'm trying to connect a LOB application that can send smtp emails from my test account. However the Exchange 365 platform requires TLS encryption…
Adam Stewart
  • 1,983
  • 1
  • 18
  • 25
43
votes
10 answers

.Net System.Mail.Message adding multiple "To" addresses

This question is pointless, except as an exercise in red herrings. The issue turned out to be a combination of my idiocy (NO ONE was being emailed as the host was not being specified and was incorrect in web.config) and the users telling me that…
Matt Dawdy
  • 19,247
  • 18
  • 66
  • 91
39
votes
12 answers

"Unable to read data from the transport connection: net_io_connectionclosed." - Windows Vista Business and SMTP

Unable to test sending email from .NET code in Windows Vista Business. I am writing code which I will migrate to an SSIS Package once it its proven. The code is to send an error message via email to a list of recipients. The code is below, however I…
john.da.costa
  • 4,682
  • 4
  • 29
  • 30
32
votes
7 answers

Multiple address in MailAddress constructor

i was trying to add multiple to address like this. MailAddress mailAddressTo = new MailAddress("sample@example.com;sample1@example.com","Vetrivelmp"); but throws error like An invalid character was found in the mail header: ';'
Vetrivel mp
  • 1,214
  • 1
  • 14
  • 29
25
votes
3 answers

System.Net.Mail and =?utf-8?B?XXXXX.... Headers

I'm trying to use the code below to send messages via System.Net.Mail and am sometimes getting subjects like '=?utf-8?B?W3AxM25dIEZpbGV...' (trimmed). This is the code that's called: MailMessage message = new MailMessage() { From = new…
Omer van Kloeten
  • 11,800
  • 9
  • 42
  • 53
23
votes
5 answers

How do I add an attachment to an email using System.Net.Mail?

I have an excel document represented as a byte[] and I'm wanting to send it as an attachment in an email. I'm having a bit of trouble constructing the attachment. I can create an Attachment which has the following constructors: (Stream…
mezoid
  • 28,090
  • 37
  • 107
  • 148
23
votes
5 answers

Can I mark an Email as "High Importance" for Outlook using System.Net.Mail?

Part of the application I'm working on for my client involves sending emails for events. Sometimes these are highly important. My client, and most of my client's clients, use Outlook, which has the ability to mark a mail message as High…
Grace Note
  • 3,205
  • 4
  • 35
  • 55
22
votes
7 answers

Why can SmtpClient.SendAsync only be called once?

I'm trying to write a notification service (for completely legit non-spam purposes) in .NET using SmtpClient. Initially I just looped through each message and sent it, however this is slow and I would like to improve the speed. So, I switched to…
Daniel
  • 1,516
  • 1
  • 13
  • 24
18
votes
7 answers

.NET Best Method to Send Email (System.Net.Mail has issues)

This seems to be pretty straight forward. I need to send email from some ASP.NET applications. I need to do this consistently without strange errors and without CPU utilization going through the roof. I'm not talking about mass emailing, just…
JustAProgrammer
  • 589
  • 2
  • 8
  • 17
17
votes
7 answers

How to embed multiple images in email body using .NET

I'm writing a program that sends emails to users with multiple images (charts) embedded in the Email message body (HTML). When I tried the sample located here..which worked well when I have to embed only one…
user330612
  • 2,189
  • 7
  • 33
  • 64
17
votes
8 answers

Send SMTP email testing Microsoft Office 365 in .net

i have a mail account on the Exchange Online service. Now i'm trying to test if i am able to send mails to customers ( on varoius domains and on Microsoft Office 365) through c# application I tried implementing the below code but i am getting the…
user166013
  • 1,411
  • 4
  • 21
  • 37
16
votes
3 answers

SmtpClient get result from server on send

The SmtpClient send method returns void. Is there any way to get the server response? Do I just assume it was successful unless it throws an exception? The class I'm referring to...…
BZink
  • 7,687
  • 10
  • 37
  • 55
16
votes
6 answers

How to confirm that mail has been delivered or not?

Below is my coding, just have a look at it System.Net.Mail.MailMessage oMail = new System.Net.Mail.MailMessage(); System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); oMail.From = new…
Sankar M
  • 4,549
  • 12
  • 37
  • 55
15
votes
2 answers

email attachment from the MemoryStream comes empty

_data is a byte[] array of Attachment data. When I'm doing this: var ms = new MemoryStream(_data.Length); ms.Write(_data,0,_data.Length); mailMessage.Attachments.Add(new Attachment(ms, attachment.Name)); Attachment comes empty. Actually…
iLemming
  • 34,477
  • 60
  • 195
  • 309
1
2 3
19 20