Questions tagged [smtpclient]

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

1275 questions
28
votes
2 answers

.NET 4.0 Fails When sending emails with attachments larger than 3MB

I recently had an issue after upgrading my .net framework to 4.0 from 3.5: System.Net.Mail.SmtpException: Failure sending mail. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at…
JL.
  • 78,954
  • 126
  • 311
  • 459
25
votes
6 answers

Can I test SmtpClient before calling client.Send()?

This is related to a question I asked the other day on how to send email. My new, related question is this... what if the user of my application is behind a firewall or some other reason why the line client.Send(mail) won't work... After the…
adeena
  • 4,027
  • 15
  • 40
  • 52
23
votes
4 answers

SmtpClient.SendAsync blocking my ASP.NET MVC Request

I have a Action that sends a simple email: [HttpPost, ActionName("Index")] public ActionResult IndexPost(ContactForm contactForm) { if (ModelState.IsValid) { new EmailService().SendAsync(contactForm.Email,…
Felipe Pessoto
  • 6,855
  • 10
  • 42
  • 73
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
22
votes
5 answers

Sending mail using SmtpClient in .net

I am unable to send the mail using smtp client. here is the code: SmtpClient client=new SmtpClient("Host"); client.Credentials=new NetworkCredential("username", "password"); MailMessage mailMessage = new…
Manish Gupta
  • 449
  • 2
  • 6
  • 16
21
votes
3 answers

Adding Bcc to Email sending using .NET SmtpClient?

When sending email using the SMTPClient class in ASP.NET C#, how can I add bcc to the email? How can I add bcc to a MailMessage instance?
Shyju
  • 214,206
  • 104
  • 411
  • 497
21
votes
3 answers

C# SMTP fails to authenticate on Outlook.com, port 587. "The server response was: 5.7.1 Client was not authenticated"

I'm attempting to send automated emails (genuinely required business reason - not spam!). Code similar to that below used to work with another mail service provider but the customer has moved to "outlook.com" and they're now getting: The SMTP…
RAM
  • 475
  • 1
  • 3
  • 14
20
votes
11 answers

Can't auth to Gmail smtp via MailMessage & smtpClient

I cannot figure out for the life of my why this isn't working SmtpClient smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, UseDefaultCredentials = false, DeliveryMethod = SmtpDeliveryMethod.Network, Credentials = new…
PositiveGuy
  • 46,620
  • 110
  • 305
  • 471
20
votes
8 answers

System.Net.Mail Alternative

I'm working on a tool that schedules emails with our mail server in C#. I had been using the System.Net.Mail classes to send the mail. Recently I've come across various issues with regards to RFC violations and other issues, such as SmtpClient not…
Martin
  • 201
  • 2
  • 4
20
votes
4 answers

SmtpException: The client or server is only configured for e-mail addresses with ASCII local-parts

The SmtpClient.Send() method is throwing this exception when I try to send an email to an address containing an accentuated character (é): System.Net.Mail.SmtpException: The client or server is only configured for e-mail addresses with ASCII…
Xavier Poinas
  • 19,377
  • 14
  • 63
  • 95
19
votes
1 answer

SmtpClient.SendMailAsync causes deadlock when throwing a specific exception

I'm trying to set up email confirmation for an ASP.NET MVC5 website, based on the example AccountController from the VS2013 project template. I've implemented the IIdentityMessageService using SmtpClient, trying to keep it as simple as…
regexen
  • 193
  • 1
  • 7
19
votes
5 answers

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated

I'm trying to send email with my website's address from a C# application. This worked fine for several months until recently. (maybe my provider changes some things or someone else changed settings) Here's the code: private void…
Adrian
  • 5,603
  • 8
  • 53
  • 85
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
18
votes
2 answers

What benefits can I take from SmtpClient.SendAsync's userToken object?

I was using SMTPClient.Send(mail) method to send emails, but then I saw, if the email id is not present (does not exists), my application waits till it receives the exception and then allows user to perform further tasks. So I thought of using…
Nagaraj Tantri
  • 5,172
  • 12
  • 54
  • 78
18
votes
2 answers

Exceeded storage allocation. The server response was: 4.3.1 Message size exceeds fixed maximum message size

I am using SMTPclient to send mail with attachment. When the attachment is more than 2mb, I am getting the below error: ** "Exceeded storage allocation. The server response was: 4.3.1 Message size exceeds fixed maximum message size".…
Ramesh.kbvr
  • 763
  • 6
  • 15
  • 31
1
2
3
84 85