Click here to Skip to main content
15,891,033 members
Everything / SMTP

SMTP

SMTP

Great Reads

by JosipK, Marko Kozlina
C# and VB.NET console applications that demonstrate how to create and send an email reply with IMAP and SMTP protocols in .NET Framework
by Uzi Granot
The attached open source C# .NET library is an SMTP client implementing implicit SSL and OAuth2 protocols. The library answers the question: how to send email message using Gmail as a server. Or, how to send email message using email server that implements implicit SSL and port 465.
by DataBytzAI
Easy way to send email on Azure with no mail server, using DNS MX and SMTP
by ObiWan_MCC
A C# SMTP server (receiver).

Latest Articles

by Jason Sultana
Understanding and preventing Newline Injection
by DiponRoy
How to run FTP, SFTP, SMTP, Cache, LDAP, SSO and other servers in Docker
by Uzi Granot
The attached open source C# .NET library is an SMTP client implementing implicit SSL and OAuth2 protocols. The library answers the question: how to send email message using Gmail as a server. Or, how to send email message using email server that implements implicit SSL and port 465.
by DataBytzAI
Easy way to send email on Azure with no mail server, using DNS MX and SMTP

All Articles

Sort by Updated

SMTP 

28 May 2011 by #realJSOP
It's probably because your email server doesn't allow relays.
29 Mar 2019 by #realJSOP
Create a rule/filter in your email app that triggers on certain phrases, like "Undeliverable" in the subject, or somethign like that.
26 Jan 2012 by 07navneet
I want to send an email to my gmail id from my web application. For now I was sending from my same id(i.e. from/to on same ID).Code: SmtpClient smtpClient = new SmtpClient(); MailAddress fromAddress = new MailAddress("navneet7988@gmail.com"); ...
7 Jun 2012 by 2011999
Dear All,please Correct the Code. This if form '>this is web.config. ...
25 Jan 2015 by Abdallah Al-Dalleh
Currently I'm having serious trouble with libeSMTP. I wanted to know what are the steps to correctly send an email with TLS enabled. I did not find any good documentation and also the only example I found is this which I could not figure out how it works.I only need a simple example that...
25 Jan 2015 by Abdallah Al-Dalleh
HelloThe example I'm talking about is here. I compiled it and everything is fine. I want to send an email from my GMail account to a Hotmail account.This is the command line options I passed to the program: -hsmtp.gmail.com:465 -fexample@gmail.com -sTest -m -c -t...
28 Jan 2015 by Abdallah Al-Dalleh
For anyone reading this, I have changed the jwSMTP to use the cURL library. It seems jwSMTP only supports plain login authentication, no security. This is the code I used.
4 Sep 2013 by Abdul 08009
Hope you all are fine.I have an application which requires to send 1500-2000 emails with attachment to the same number of customers. My Question is "What would be best practice to achieve that efficiently?"Whether 1)It can be done efficiently by organization's email account -...
7 Sep 2011 by Abhijit Jana
Here you go,Config the Server SMTP IIS to send Mail[^]andhttp://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e4cf06f5-9a36-474b-ba78-3f287a2b88f2.mspx?mfr=true[^]
27 Feb 2012 by Abhinav S
To send emails - How to send email from C# [^] should help you get started.Try (for the GridView) How to Make GridView Auto Partial Update like Gmail Inbox[^].If you want Facebook style view - see here[^].
13 Dec 2014 by abu5alilo
hi alli use this code to send email using asp and c# SmtpClient client = new SmtpClient(???); MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress("senderEmail"); mailMessage.To.Add("ToEmail"); ...
19 Dec 2014 by Afzaal Ahmad Zeeshan
Let me intervene here before giving you a solution. Since you're using ASP.NET, why are you using the .NET way of sending the emails. ASP.NET has their own method of sending emails, which makes sending emails in ASP.NET a bit easy and efficient for the developers. You can read on sending the...
6 Mar 2015 by Afzaal Ahmad Zeeshan
This article explains the core concepts about sending the emails over .NET framework and the problems that new .NET developers face in using them also some tips for removing very basic errors.
20 Mar 2015 by Afzaal Ahmad Zeeshan
You should know that there is something know as a variable in programming. Which can be filled with any value that your application (or more specifically "you") want to use. So for example, if you use the WebMail class to send the email, then the following code would be used,// client,...
27 Aug 2016 by Afzaal Ahmad Zeeshan
In the code that you show, MailMessage mis = new MailMessage(); SmtpClient smtpserver = new SmtpClient("smtp.gmail.com"); smtpserver.Credentials = new System.Net.NetworkCredential("rajesh@gmail.com","12345"); smtpserver.Host =...
17 Dec 2016 by Afzaal Ahmad Zeeshan
Continuing from the comments, 587 is correct port for Yahoo Mail and default TCP port for SMTP 25 also works, that is standard based and not Yahoo specific. The problem is with your username/password combination, you need to check them out to make sure they are correct. Sending emails over...
26 Jan 2017 by Afzaal Ahmad Zeeshan
Your code looks fine to me, and it should send the email (and of course, should connect to the server), did you try connecting through the default TCP port for SMTP communication? That is 25, consider trying that one out, using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25))Other than...
6 Apr 2015 by Agent__007
As per the error message "The remote certificate is invalid according to the validation procedure." in one of your comments above, you may want to perform these diagnostic steps[^]. Also ensure that the system's date and time are correct. Hope this helps.
30 Jan 2013 by Ahmad Abd-Elghany
hi , i have this code scritp that send message from the contact us form to the mail.but it work good on my local server , after upload the side it never send it ! public string SendMail(string toList, string from, string ccList, string subject, string body) { ...
8 Feb 2014 by Ahmed Bensaid
Take a look there ;)http://technet.microsoft.com/fr-fr/library/cc772058%28v=ws.10%29.aspx[^]
17 Dec 2019 by ahmed_sa
I doing contact system web application using c sharp asp.net using library mail kit the problem is when some one reply to my email from outlook 2010 to any email I sent it then on my web application reply id on debug show null when receiving . so How any email server like google,Microsoft know...
16 Aug 2013 by Ajay (.NET)
Thanks...I have implement the different API.
20 Mar 2015 by Ajith_joseph
Hi All,I would like to develop an option in my project to contact the seller. It should something like Ebay contact seller. The from and replay mail ids should be from my domain and the message should be sent to the seller. How do I can develop a contact seller option via email like...
13 Apr 2015 by akminder2013
Hi,I am using php mailer to send mail from localhost but it is not working and showing the below given error:Invalid address: SMTP -> ERROR: Password not accepted from server: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14...
3 Oct 2011 by Al Moje
Hi,I think you could do it by Attachment on you smtp email...See this link if it could help....System.Net.Mail FAQRemember to vote if it help...Regards,Algem
17 Dec 2016 by Ali Majed HA
HelloI want to send user an email in my asp.net project, but I am receiving this error on run time:The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication requiredWhat I have tried:email class:public...
29 Jan 2014 by Alvin20
Have you tried using the RegAsm from the 64bit directory of .NET, that worked for me
29 May 2023 by Andre Oosthuizen
Your error referes back to your first line ofr validation - if( $_POST['form_name'] != '' AND $_POST['form_email'] != '' AND $_POST['form_subject'] != '' ) which tells you that one of your required fields is empty. The way to solve this is to...
16 Oct 2012 by Anele Ngqandu
MailMessage message = new MailMessage(); message.From = new MailAddress("Ngqandu.Anele@gmail.com"); message.To.Add(new MailAddress("Anele.Ngqandu@live.nmmu.ac.za")); message.Subject = subject.Text; message.Body = body.Text; ...
11 Mar 2012 by Aniket Yadav
For Gmail Account SMTP, disable 2 step verification and send email.Also refer this from codeproject articleSending an Email in C# with or without attachments: generic routine.[^]
29 May 2014 by Animesh Datta
Hello ,This problem occurs may be for weak password .Refer link : 5.5.1 Authentication Required with smtp.gmail.comalso check : This thanks
22 May 2019 by Anish_Chakraborty
We use a 3rd party software to send Bulk Emails. The software does not provide options to add Email addresses in BCC. However, as per Compliance Rules, it is necessary for us to add a BCC address to every Email sent. Till now, we used to relay all the Emails from that software to an intermediate...
15 Feb 2015 by Anisuzzaman Sumon
You should use timeout for your table adapter .To set command timeout go to 'yourdataset.Designer.cs' that holds your FeeMsgTableAdapters defination(Or right click on FeeMsgTableAdapters and Go to Defination that leads you to the code page descussed here ).Then search for public...
13 Jun 2018 by ansh_kumar
I want to send an email with attachment from c++ using libcurl( http://curl.haxx.se/[^]).I'm able to send an email successfully from gmail server but don't know how to send with attachment.The code I'm using is as follows:#include #include #include...
21 Nov 2014 by ansh_kumar
After a very long observation and experimentation I finally found the solution.It will be too long to give details of how this code work, so I'm simply putting the working code:#include #include #include #include #define FROM ...
23 Nov 2014 by ansh_kumar
The code bellow uses Imagemagick++http://www.imagemagick.org/Magick++/[^] to base64 encode the image.#include #include #include #include #include #define FROM ""#define TO ""#define...
17 Apr 2017 by Anup KumarArya
//import static com.sun.org.apache.xalan.internal.lib.ExsltDatetime.date; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Date; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import javax.mail.*; import...
18 Feb 2014 by AnvilRanger
Instruct your users when entering multiple email address in the TO and CC fields to separate them with either a comma or semicolon.
13 Apr 2017 by AnvilRanger
What that error means is the mail server that received your message thought it was spam based on a combination of several factors. The content, encoding, domain, signature, etc and for some reason flagged that as spam. When you continued to send a message Spamhaus blocked your ip or domain as...
2 Jul 2012 by arielbeck
Hello, i have an issue:i have Microsoft SMTP Virtual Server, which listens to smtp requests.Each requests, needs to be passed to a directory, instead of passing it to a mail server.i've used the "Smart host" and declared a dummy domain, thus, the files are staying at the "Queue"...
15 Aug 2012 by arielbeck
hello, i'm a bit in a dead end here.i have the following EML:this is part of my eml file:------=_NextPart_001_0046_01CD587D.979ABFF0Content-Type: text/plain; charset="us-ascii"Content-Transfer-Encoding:...
23 Oct 2012 by arielbeck
Hey, I'm facing the following problem:1. i have Exchange server (2007).2. i want to be able to do the following:for each mail that its subject starts with "s:", instead of sending it to the recipient, forward it to a specific internal IP addressi've tried transport rules, i can specify...
23 Oct 2012 by arielbeck
Managed to do it using TransportAgent - which redirects mails to a smart host (send connector) that should be defined.
19 Nov 2012 by arielbeck
hello, After long investigation, it seems that iis7 doesn't support anymore the SMTP Sinks (to hook into the SMTP server).is there any replacement for it? in C#/c++?thanks..
17 Dec 2012 by arielbeck
well, it seems no help was given. anyway they removed the support for C#/C++ sinks, only CDO OnArrival is supported.
11 Oct 2013 by ASP.NET Community
Following Codes demonstrates how to send an email with SMTP Authentication using ASP.NET 3.5using System.Net.Mail        MailMessage msgMail =
11 Oct 2013 by ASP.NET Community
Scenario: Using ASP.NET membership model to display custom error messages to general users of a website. Send an email to a Webmaster with all the
11 Oct 2013 by ASP.NET Community
Introduction When you want to send email message, you must create an instances of MailMessage and SmtpClient classes. This classes are in
21 Feb 2012 by awedaonline
hi everyone,how do I make emails deliver to inbox not junk box.i am using a pickup directory.please help!
16 May 2014 by baotdinh
Hi all !!!I have a problem. Please help me !!! help me.I have a smtp server A with smarthost Yahoo.In my code, i use smtp server A , when i call function smtpclient.send(mailmessage), it will relay to yahoo to send. But i can only use smart host when yahoo's account in smarthost same as...
18 Mar 2012 by Bernhard Hiller
There can be several reasons, but in all cases it is based on a change of security mechanisms of your provider.Did you try to send an email with a "FROM" header different than the user name of your credentials?Did the provider put your computer on a blacklist of spammers?
19 Jul 2012 by Bernhard Hiller
I do not fully understand what you want to tell us. What is that "fake email id"? If that is simply a "FROM" entry ("sender") of someone who did not send the email, following information: an email can be sent by someone on behalf of someone else. E.g. a secretary sends an email on behalf of...
30 Aug 2012 by bhagyap
Following is my code:-string to, sub, mess; to = "info@sdmmedicalcollege.org"; sub ="Weekly Clinical Quiz"; mess ="Quiz Title: " + dr["Quiz_Title"].ToString() + "Name: " + txtName.Text + " Email: " + txtEmail.Text + "Clinical Diagnosis: " +...
8 Nov 2016 by Bigprey
In one of my asp.net pages (C#), I am using a SMTP mail option. Everything works fine in the mail such as subject, To addresses etc except for the BCC to a default gmail address (I use this to verify how the mail end up at others mailbox).protected void SendEmail(string MemberName, string...
8 Nov 2016 by Bigprey
I found the issue.Only the Gmail is not accepting BCC. I thought since "To" addresses has some including gmail ids & receiving mails, then it should also accept BCC.Anyway, I only thought of knowing how the mail gets shown up in other's gmail inbox. So, I can't find it through BCC method.
7 Feb 2012 by biki66
Hi,When trying to send an email using gmails SMTP server I get the following error:"Service not available, closing transmission channel. The server response was: Cannot connect to SMTP server 173.194.67.108 (173.194.67.108:587), connect timeout"My code is as...
8 Feb 2012 by biki66
Hi,Thanks all for your posts, I have resolved this for now by using a SMTP server but I believe the issue to be network related as a friend is able to ping the server from his machine.
30 Jun 2012 by bikramjeet.sm
Hello Guys,I Ned a help, i want to develop a website like gmail where your can able to send email, receive email on my website. so want to developIMAP server: imap.mywebsite.comPOP server: pop.mywebsite.comSMTP server: smtp.mywebsite.comi did't get idea about this how can i develop...
20 Apr 2016 by bindash
hii all i am getting an error in sending mail module in my asp .net web application.my mail module is working properly in local host.. when i publish my applicationmy btnsnd_click code isstring usertype = string.Empty;DataTable dt = new DataTable();try{ for (int i = 0;...
26 Jan 2012 by Bojjaiah
The remote name could not be resolved: 'smpt.gmail.com'you are using smpt.gmail.cominsted of this smtp.gmail.com => use it's working MailAddress mailfrom = new MailAddress ( "frommail@gmail.com" ); MailAddress mailto = new MailAddress ( "tomail@gmail.com" ); ...
7 Feb 2012 by Bojjaiah
MailAddress mailfrom = new MailAddress ( "frommail@gmail.com" ); MailAddress mailto = new MailAddress ( "tomail@gmail.com" ); MailMessage newmsg = new MailMessage ( mailfrom, mailto ); newmsg.Subject = "Subject of Email"; newmsg.Body =...
8 Mar 2012 by Bojjaiah
try this MailAddress mailfrom = new MailAddress ( "frommail@gmail.com" ); MailAddress mailto = new MailAddress ( "tomail@gmail.com" ); MailMessage newmsg = new MailMessage ( mailfrom, mailto ); newmsg.Subject = "Subject of Email"; ...
1 Apr 2012 by Bojjaiah
try this MailAddress mailfrom = new MailAddress ( "frommail@gmail.com" ); MailAddress mailto = new MailAddress ( "tomail@gmail.com" ); MailMessage newmsg = new MailMessage ( mailfrom, mailto ); newmsg.Subject = "Subject of Email"; ...
3 May 2015 by Brady Kelly
I am trying to write a small tool to poll a POP3 account for new mails, then change a few addressing headers, then re-send via SMTP. I have some doubts and unknowns regarding how to best prepare the outgoing SMTP message.I have two third-party, candidate POP3 clients, given .NET's glaring...
27 Jan 2012 by Bryian Tan
hi 07navneet,Your original code is fine. Let try this. Ping the smtp.gmail.com, get its IP address and replace the smtp.gmail.com in your code with the IP address.Thanks,Bryian Tan
29 Jul 2015 by bspilove
Put smtp.UseDefaultCredentials = false; above the smtp.Credentials assignment.
24 Sep 2012 by c0d3r76
Hi Everyone,I was wondering, why is it that I can't use the SMTP Client and GMAIL in sending an email in the office PC.Is it because of the security issues?Is there a way or work-around that I can use to have a program sending email using SMTP Client and GMAIL?
25 Sep 2011 by CarrieEJ
Hi,I've set up IIS 7 on Windows server 2008 R2 and have enabled SMTP.In the SMTP E-Mail Settings there is an option to store e-mails in a pickup directory for later delivery.I was wondering if it is possible to change the email extention to a .pickup extention before it has been...
7 Nov 2012 by CBadger
You can create a Method to send the mail through proxy...MailAddress from = new MailAddress("from@mailserver.com");MailAddress to = new MailAddress("to@mailserver.com");MailMessage mm = new MailMessage(from, to);mm.Subject = "Subject"mm.Body = "Body";SmtpClient client = new...
8 Jan 2012 by CGN007
Hi,How can I request Delivery Status Notification in SMTPand how can I parse it?I,m using this asmailmessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;Mailing is success,but I'm not getting any delivery status.Can anyone identify the reason ?By using ...
28 May 2015 by Chandramani.srivastava
To Fix THis Problem Go tO GMAIL CHANGE SECURITY SETTING ... For Access Less Secure App Turn it OFF and Send mail with above codeany problem contact : chandramani.sri @ gmail.com
9 Sep 2014 by Charles J Cooper
In order to send emails to people outside your network successfully it needs to come from a registered email server. This one seems relatively inexpensive. http://www.jangosmtp.com/
31 Mar 2012 by CharlieSimon
The code below works for me... I have heard anecdotally that UseDefaulCredentials=false must precees the Credentials line var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, ...
9 Aug 2013 by chauhan.haresh
Use following piece of code to add attachment,Attachment attachment = new Attachment(attachmentFilename, MediaTypeNames.Application.Octet);ContentDisposition disposition = attachment.ContentDisposition;disposition.CreationDate =...
29 Sep 2014 by ChauhanAjay
Change the code toMailMessage mail = new MailMessage();//Setting From , To and CCmail.From = new MailAddress("MyEmailID@gmail.com", "MyWeb Site");mail.To.Add(new MailAddress("eruoghene507@gmail.com"));mail.CC.Add(new MailAddress("MyEmailID@gmail.com"));mail.Body = msgtext.Text;...
8 Jan 2013 by Christian Graus
You need it if the server requires it to log in.
2 May 2012 by Code Master38
Hello,I am wondering if there a .net wrapper class for RECEIVING email from Gmail? I could not find one on Google.I figured out how to send an email from Gmail in .net but everyone seems to say that receiving one is quite hard. So I'm wondering is there a wrapper class somewhere that I...
2 Nov 2012 by Code-Hunt
http://msdn.microsoft.com/en-u...
21 Dec 2011 by coded007
Quote:mail.Fro...
22 Dec 2011 by coded007
look over this http://www.astahost.com/info/tilffm-sending-mail-net.html[^]
22 Nov 2012 by CodingLover
Hi all,In Win7 what's the best SMTP server I can use for emailing in PHP, on your experience. It's really nice if the same server works fine in server 2003.Thanks in advance.
8 Sep 2014 by cogi83
A SW to send your WAN IP and other info via email
5 Aug 2013 by CommanderRykker
I need to develop a SMTP email service within our application. The application is coded in C++ using the .NET framework. I've looked everywhere online but I have been unable to find anything useful. Mostly what I find is information about setting up an email service in HTML. I just need to...
8 Aug 2013 by CommanderRykker
I work on developing EMR software and we are working towards meeting Meaningful Use Stage 2. Part of the requirements entail adding functionality to send messages and documents that adhere to the Direct Standard specifications (which is a fancy way of saying 'e-mail' but with specific rules...
15 Apr 2015 by CPallini
You should use the std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) function to encode your (binary) string.
13 Jan 2012 by Cr4zYPT
Good Afternoon,I'm building a email client that uses smtp to send email, but i have a small problem.Some smtp servers such as gmail/hotmail require SSL.Example:me:EHLO localhostme:auth loginsv:.... requires STARTTLSSo i send the comand STARTTLS and it replies 220 2.0.0 SMTP...
23 Jan 2012 by cutexxbaby
i have trying to on how to do on reseting password by emailhowever when i click on the button it prompt "The remote name could not be resolved: 'myemail@hotmail.com' at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket&...
17 Jul 2016 by d_wade
Also, be sure you're using the actual office365 email address for the account. You can find it by clicking on the profile button in Outlook365. I wrestled with authentication until I realized the email address I was trying to use for authentication wasn't the actual mailbox email account. it...
6 Jul 2014 by DamithSL
try below SmtpClient smtp= new SmtpClient("smtp.gmail.com", 587);smtp.EnableSsl = true;smtp.UseDefaultCredentials = false;smtp.Credentials = new NetworkCredential("username", "pass");smtp.Send(mm);
4 Feb 2018 by DataBytzAI
Easy way to send email on Azure with no mail server, using DNS MX and SMTP
2 Jun 2011 by Dave Kreskowiak
It's nice idea and all, but it's impossible to do.There is no method for verifying that an email address is real or not, nor is there any method that happens to work on one service, like GMail, that will work for every other service on the 'Net.
30 Jan 2013 by Dave Kreskowiak
You set UserDefaultCredentials to True, which tells the SmtpClient to ignore any settings in the Credentials property. This results in the SMTP server getting the credentials of the ASP.NET account your code is running under, NOT the credentials you provided.
30 Apr 2013 by Dave Kreskowiak
The code LOOKS correct, but without knowing the exception that's thrown, it's difficult to say.The network credentials must be a valid GMail login name.Your work server cannot lbokc access to the GMail servers (most corporate networks do!)You cannot use your GMail email address in...
13 Mar 2014 by Dave Kreskowiak
This has nothing to do with your code and there is nothing you can do about it, other than changing the server you're using to send mail.It's telling you, point blank, that the server REQUIRES the sender address to match the account that was used to login to the SMTP server. You cannot get...
16 Jan 2015 by Dave Kreskowiak
No enough information.Since TextBox.Text just returns a string, you just have to type "user1" (without the quotes) into your usertextbox and you get the exact same thing.The server is telling you that whatever you're doing isn't authorized, given the data that you sent.
17 Apr 2017 by Dave Kreskowiak
That's not a "null server" error. That's a SEVERE error, meaning that the code cannot continue. There error message is telling you exactly what to do. You should try reading it again and reading up on the STARTTLS command.
19 Jan 2023 by Dave Kreskowiak
If you're using the SMTP route into Outlook365, you do not have the option of turning SentItems off. On normal servers, using SMTP does not put anything in SentItems, but Office365 is not the standard email environment the web uses. Things are a...
15 Aug 2013 by DaveWelsh
I have my own Postfix server that we use every day with Thunderbird clients.When I try to send mail through our Postfix server via System.Net.Mail.SmtpClient, I'm getting error 5.7.1 Relay Access Denied. To work around this, I've added our office's static IP address to $mynetworks. I would...
30 Sep 2016 by David_Wimbley
We are not your hosting company so no one can help you but your hosting company. As to your error message it is pretty clear what your issue is:Quote:System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server --->...