SMTP Relay

Send email Asynchronous with Attachment and Carbon-copy.

[asp.aspx.cs] 
C# Code behind
  List<string> aMyAttach = new List<string>();
  aMyAttach.Add("c:\\temp\\myfile.pdf") 
  //- Send the email with attachment.
  NetstairSMTPRelay.MailHelperV5 oMsg = new NetstairSMTPRelay.MailHelperV5();
  oMsg.BusinessInfo = "ABC, Inc";
  oMsg.SendAsyncEmail("johndoe@domain.com","", "Hello World", "Testing SMTP Relay", true, aMyAttach);
  var _sMailServerError = oMsg.Server_ErrorMessage;
  bool _bSuccessfullySent = oMsg.SuccessfullySent;            
  oMsg = null;
You must add the following to the Web.Config file in your ASP.NET WebForm Project Right after the closing  </system.web> tag
<system.net>
	<mailSettings>
		<smtp from="youremail@gmail.com">
		<network host="smtp.gmail.com" userName="youremail@gmail.com" password="{password goes here}" port="465" enableSsl="true" defaultCredentials="false" />
		</smtp>
	</mailSettings>
</system.net>
You must have enabled IMAP/POP3 Sending in your GMAIL Account otherwise Gmail will not allow to use your email for relay. Click for detail

Download NetstairSMTPRelay.dll here and add it to your project bin folder --> NetstairSMTPRelay.zip

Add Feedback