on .NET Framework , allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP)
Questions tagged [smtpclient]
1275 questions
18
votes
3 answers
Mailbox unavailable. The server response was: 5.7.1 Unable to relay Error
I have Hosted one of my website on netsol server. From there a contact.aspx has to send email using exchange server. When I attempt to send an email:
Error: Mailbox unavailable. The server response was: 5.7.1 Unable to relay
Code:
MailMessage…

ArjunArora
- 986
- 3
- 12
- 27
17
votes
8 answers
smtpclient " failure sending mail"
here is my code
for(int i = 0; i < number ; i++)
{
MailAddress to = new MailAddress(iMail.to);
MailAddress from = new MailAddress(iMail.from, iMail.displayName);
string body = iMail.body;
string subject = iMail.sub;
oMail = new…

Nnp
- 1,813
- 7
- 36
- 62
17
votes
4 answers
Confused with the SmtpClient.UseDefaultCredentials Property
In my MVC4 application, I'm using the SmtpClient to send out email via Gmail's smtp.gmail.com SMTP server.
I've configured my Web.Config file with the following settings:

Jed
- 10,649
- 19
- 81
- 125
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
4 answers
Getting a sent MailMessage into the "Sent Folder"
I'm sending MailMessages with an SmtpClient (being delivered successfully) using an Exchange Server but would like my sent emails to go to the Sent Folder of the email address I'm sending them from (not happening).
using (var mailMessage = new…

Robert Reid
- 415
- 1
- 6
- 12
15
votes
1 answer
C# - Can't send mail in WIndows Azure via Gmail SMTP
This is my Web.config:
…

Rubia Gardini
- 815
- 5
- 16
- 30
15
votes
1 answer
How to send an e-mail with C# through Gmail
I am getting an error when trying to send an e-mail through my web service. I have tried enabling access to less secure apps disabling 2-step verification and logging into the account via a web browser. None of the solutions on SO have worked for…

Johnny
- 675
- 3
- 15
- 25
15
votes
4 answers
How does my ASP.NET app get the SMTP settings automatically from web.config?
I noticed that we always just are like:
SmtpClient mSmtpClient = new SmtpClient();
// Send the mail message
mSmtpClient.Send(mMailMessage);
And the only place the credentials are set are in web.config:
…

MetaGuru
- 42,847
- 67
- 188
- 294
15
votes
3 answers
Getting "The remote certificate is invalid according to the validation procedure" when SMTP server has a valid certificate
This seems a common error but while I've found a work-around (see below) I can't pin down the reason I'm getting it in the first place.
I am writing SMTP functionality into our application and I'm attempting to add SSL functionality to the working…

RosieC
- 649
- 2
- 11
- 27
14
votes
2 answers
Difference between smtpClient.send() and smtpClient.SendAsync()?
I am trying to send mail from localhost..
and on doing this i have got methods from different sites to sending mails..but on doing this i am confused between smtpClient.send() and smtpClient.SendAsync()..
I want to know that How they are different…

divya
- 405
- 2
- 6
- 18
14
votes
6 answers
Can I send email using javascript
Is it possible to send emails using just javascript?

dotty
- 40,405
- 66
- 150
- 195
14
votes
3 answers
Getting SmtpClient to work with a self signed SSL certificate
I'm attempting to use the System.Net.Mail.SmtpClient class to relay an email through my company's email server. All SMTP connections to the mail server have to be SSL and it uses a self signed certificate. That's fine for Outlook where you can just…

sipsorcery
- 30,273
- 24
- 104
- 155
14
votes
1 answer
SmtpClient sending without authentication
I am sending emails to our clients from Java. And there is no any authentication for our SMTP. So I use the following code in Java to send it without authentication:
Properties props = new Properties();
Session session;
props.put("mail.smtp.auth",…

Himanshu
- 31,810
- 31
- 111
- 133
13
votes
1 answer
Enabling TLS 1.2 without changing code in .NET
I have .NET 4.5.2 application that is using SmtpClient to send emails. The application is installed on Windows 2012 R2 server. When I disable TLS 1 and TLS 1.1 and enable only TLS 1.2, the application stops sending mails. I think that's because .NET…

LP13
- 30,567
- 53
- 217
- 400
13
votes
1 answer
Why emails sent by smtpclient does not appear in sent items
I have implemented a server that sends emails via .Net SmtpClient.
the mail sending code looks like that:
private static MailMessage SendMail(string to, string subject, string body)
{
MailMessage mailToSend = new MailMessage();
mailToSend.Body =…

yossico
- 3,421
- 5
- 41
- 76