Questions tagged [smtpclient]

on .NET Framework , allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP)

1275 questions
7
votes
7 answers

SmtpClient very slow - about 2 seconds to send one very small email

I'm using SmtpClient to send a simple email. The email consists of about 25 plaintext characters so it's small. It however takes the SmtpClient about 2000 milliseconds to send one of them. I do not create the SmtpClient for each send - that is…
Ted
  • 19,727
  • 35
  • 96
  • 154
7
votes
1 answer

NodeMailer queuing outgoing email, but email never sends

I'm trying to send an email from my own domain without using an external SMTP server. I'm using NodeMailer's SMTP connection: let options = { secure: true, port: consts.portOut,//465 host: consts.host, //mydomain.com transactionLog:…
now_world
  • 940
  • 7
  • 21
  • 56
7
votes
1 answer

What could be reasons that Microsoft retired SmtpClient?

In .NET Framework 4.7 doc, Microsoft marked SmtpClient obsolete with the following reason: SmtpClient and its network of types are poorly designed, we strongly recommend you use https://github.com/jstedfast/MailKit…
Luke Vo
  • 17,859
  • 21
  • 105
  • 181
7
votes
4 answers

SmtpClient won't authenticate when inflated from web.config

When using the system.net/mail web.config settings to configure my SmtpClient, it fails to deliver emails, with an "protocol error" described best by Base64 encoding and authentication problems: Example: With the following Config
Matt Murrell
  • 2,321
  • 2
  • 23
  • 39
7
votes
1 answer

SmtpClient.SendAsync not sending email versus SmtpClient.Send

I am working on a project which (unfortunately) requires the maximum framework allowable to be .NET 4. In this project I am attempting to send an email asynchronously using SendAsync() but for some reason, it fails to send (or rather, it just…
tastydew
  • 677
  • 8
  • 21
7
votes
2 answers

Cause of TaskCanceledException with SendMailAsync?

I don't understand the difference between these two implementations of calling SendMailAsync. Much of the time with the first, I'm receiving a TaskCanceledException, but with the second, everything works as expected. I thought the two consuming…
Brian Vallelunga
  • 9,869
  • 15
  • 60
  • 87
7
votes
1 answer

Execute default certificate validation when overriding ServicePointManager.ServerCertificateValidationCallback

I use a SmtpClient to send emails through a SMTP server using SSL. This SMTP server is configured to use a self-signed certificate. Since it's out of scope for me to install the certificate on all client machines, I added a…
Benjamin Beaulieu
  • 995
  • 2
  • 10
  • 26
7
votes
1 answer

"The function requested is not supported" exception when using SmtpClient in Azure role

I'm getting an exception when using SmtpClient in an Azure Web or Worker role. I created a console app to manually run on the role VMs via RDP to reproduce: using System; using System.Net; using System.Net.Mail; using System.Text; namespace…
Mike Asdf
  • 2,309
  • 26
  • 34
7
votes
2 answers

How to use any email address in the FROM field while sending email through Gmail SMTP?

I'm trying to send an email using gmail SMTP in C# using the code bellow MailMessage message = new MailMessage(); message.To.Add("my email"); message.Subject = "subject"; message.From = new MailAddress("any email"); message.Body =…
Victor
  • 8,309
  • 14
  • 80
  • 129
7
votes
1 answer

Using SmtpClient, and getting "the target machine actively refused it"

I am trying to use System.Net.Mail for an application to send an email, but get this exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> …
Cyberherbalist
  • 12,061
  • 17
  • 83
  • 121
7
votes
2 answers

Why SmtpClient.UseDefaultCredentials is ignored?

I'm trying to send e-mails through a domain SMTP server which uses Integrated Windows Authentication. When explicitly specifying the credentials, everything works fine: using (var client = new SmtpClient("")) { client.Credentials = new…
Arseni Mourzenko
  • 50,338
  • 35
  • 112
  • 199
6
votes
1 answer

How to send mails using SmtpClient and DefaultNetworkCredentials to a distribution list that only allows authenticated senders?

I'm trying to send automated emails from a C# console application from machines to clients all on the same domain via our internal Exchange 2007 server (using SMTP), but I'm hitting a snag with distribution lists that only allow authenticated…
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
1 answer

SMTP mail with encrypt permission Outlook

When I send a mail with the option "Encrypt only" in Outlook I receive a mail like this : Currently, I use SMTPClient with MailMessage to send mail : MailMessage message = new MailMessage(); message.From = from; MailAddress to = new…
Antoine V
  • 6,998
  • 2
  • 11
  • 34
6
votes
5 answers

Throttling speed of email sending process

Sorry the title is a bit crappy, I couldn't quite word it properly. Edit: I should note this is a console c# app I've prototyped out a system that works like so (this is rough pseudo-codeish): var collection = grabfromdb(); foreach (item in…
ChadT
  • 7,598
  • 2
  • 40
  • 57