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
11
votes
4 answers

Using System.Net.Mail in ASP NET MVC 6 project

I have trouble creating a simple mock mail sender within an ASP NET 5 project. Here the method : public static Task SendMail(string Email, string Subject, string Body) { SmtpClient client = new SmtpClient(); …
11
votes
2 answers

The parameter 'addresses' cannot be an empty string

I am trying to send an email in ASP.NET using the System.Net.Mail.SmtpClient class. However I am getting the following exception message: The parameter 'addresses' cannot be an empty string. Parameter name: addresses This is my send email…
user2931015
  • 219
  • 2
  • 8
  • 21
10
votes
1 answer

ServicePointManager SecurityProtocol conflict

In my app I use the RestSharp to query a REST API and System.Net.Mail to send emails. On the program startup I set the ServicePointManager.SecurityProtocol property. If I set the property to: ServicePointManager.SecurityProtocol =…
lng
  • 805
  • 1
  • 11
  • 31
9
votes
3 answers

System.Net.Mail.SmtpException: Insufficient system storage. The server response was: 4.3.1 Insufficient system resources

I've recently designed a program in C# that will pull information from SQL databases, write an HTML page with the results, and auto-email it out. I've got everything working [sporadically], the problem I'm having is that I seem to be crashing our…
Chrsjkigs99
  • 850
  • 1
  • 9
  • 18
8
votes
4 answers

Can I turn off the email address validation in System.Net.Mail?

I'm trying to talk to Fax server software using an email. The fax server will accept formatted SMTP mails and covert them to faxes and send them to the fax number defined in the to address. This has been manually tested by sending an email from…
Chris Gill
  • 2,848
  • 5
  • 26
  • 31
8
votes
3 answers

C# Get filename from mail attachements

I have a simple C# app that send SMTP emails (using System.Net.Mail classes). After sending (emailing) a MailMessage object I want to iterate through the list of the attachments and delete the original files associated with those attachments... but…
Clinemi
  • 906
  • 6
  • 20
  • 33
8
votes
0 answers

SmtpClient.send(MailMessage) is adding an extra period in the body text of the email

I'm using System.Net.Mail.SmtpClient. I build my MailMessage. IsBodyHtml is set to true. The Body is some html with some links. Occasionally, some strange behavior occurs - an extra period will get added to one of the links. for example, the link…
John-Luke Laue
  • 3,736
  • 3
  • 32
  • 60
7
votes
0 answers

What version TLS does System.Net.Mail.SmtpClient support?

I'm sending emails using System.Net.Mail.SmtpClient. It has an EnableSsl property that seems to work most of the time, but now one user claims that his email provider will only accept connections with minimum TLS 1.2 and that he is trying to connect…
Frisk
  • 743
  • 1
  • 7
  • 8
7
votes
1 answer

How do you specify Content-Type Name and Content-Disposition Filename using Attachment and LinkedResource?

Emails generated using System.Net.Mail.Attachment and System.Net.Mail.LinkedResource contain MIME parts. The question is how to specify the Content-Type Name and Content-Disposition Filename values and encodings for the headers in those MIME…
Mike Green
  • 2,031
  • 2
  • 18
  • 16
7
votes
4 answers

GMail not showing inline-images (cid) i'm sending with System.Net.Mail

When I send an email via outlook or gmail to a gmail email address I can add inline-images which are directly shown in the gmail webinterface: Relevant raw mail-header and raw body parts of the working…
Matthias
  • 948
  • 1
  • 6
  • 25
7
votes
2 answers

Sending to multiple Email addresses but displaying only one C#

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…
dagda1
  • 26,856
  • 59
  • 237
  • 450
7
votes
1 answer

Emailing a log4net log as a System.Net.Mail.Attachment throws IOException (process locked)

I wanted to send the current log4net log as an email attachment using System.Net.Mail.Attachment but when I pass in the file path an IOException is thrown. Attachment mailAttachment = new Attachment(logPath); The process cannot access the file…
Ian R. O'Brien
  • 6,682
  • 9
  • 45
  • 73
6
votes
2 answers

System.Net.Mail and MailMessage not Sending Messages Immediately

When I sent a mail using System.Net.Mail, it seems that the messages do not send immediately. They take a minute or two before reaching my inbox. Once I quit the application, all of the messages are received within seconds though. Is there some sort…
mservidio
  • 12,817
  • 9
  • 58
  • 84
6
votes
2 answers

How do I send an email to an address with a dash in it?

Is it me or is there a bug in the MailAddress class in System.Net.Mail? This code will always throw an excpetion: MailMessage mail = new MailMessage(); mail.From = new MailAddress("me@me.com"); mail.To.Add("joe-blow@me.com"); mail.Subject =…
thorkia
  • 1,972
  • 1
  • 20
  • 26
6
votes
1 answer

Sending an email through c# with a custom domain from gmail

So... I have a project in Visual Studio 2015, coded in C#, that sends emails, everything works fine with commom gmails and hotmails, SSL enabled, ports, etc... They are able to send emails and to authenticate. But now my studio has a gmail custom…
1
2
3
19 20