Click here to Skip to main content
Licence 
First Posted 25 Oct 2003
Views 81,262
Bookmarked 31 times

SMTP Mailer with Authentication

By | 25 Oct 2003 | Article
.NET assembly, 100% managed code. Send mails using a SMTP server that requires authentication.

Introduction

This article describes a simple assembly to send mails programmatically using a SMTP server that requires authentication. It also works with those servers that doesn't require it.

In this release, you cannot use attachments, but I will implement it as soon as possible.

To show you how simple this component is, I'll show you it's main interface:

The main method is SendMail:

1st Overload

Used for sending a simple mail using a server without authentication. The default MailFormat is HTML.

public System.Boolean SendMail ( System.String from , System.String to , System.String subject , System.String message , System.String serverName )

2nd Overload

Used for sending a simple mail using a server with authentication. The default MailFormat is HTML.

public System.Boolean SendMail ( System.String from , System.String to , System.String subject , System.String message , System.String AUTH_Name , System.String AUTH_Password , System.String serverName )

3rd Overload

Used for sending a mail using a server with authentication. Here you can specify the MailFormat and also the server port.

public System.Boolean SendMail ( System.String from , System.String to , System.String subject , System.String message , MailFormat format , System.String AUTH_Name , System.String AUTH_Password , System.String serverName , System.Int32 port )

When the method SendMail returns false, you have an Err property that contains the Exception that originated the failure of the method call.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

pjutard

Web Developer

United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralGmail PinmemberRunnerDude8:17 6 Jul '07  
GeneralIt's working! Pinmember_BlackLine_7:44 23 Apr '06  
Generaldifferent views in different Browsers PinmemberRamalinga S Reddy19:47 26 Mar '06  
GeneralI could not be able to run PinmemberRamalinga S Reddy19:34 26 Mar '06  
GeneralTime stamp says 12/31/1969 PinmemberFinishedOnTime10:57 14 Mar '04  
GeneralGet an Error Pinmemberrockhopper1286:02 19 Nov '03  
GeneralRe: Get an Error Pinmemberpjutard6:19 19 Nov '03  
QuestionHow about other encoding mail? PinmemberHardy3:00 14 Nov '03  
AnswerRe: How about other encoding mail? Pinmemberpjutard4:35 14 Nov '03  
GeneralOOP PineditorHeath Stewart18:08 26 Oct '03  
GeneralRe: OOP Pinmemberpjutard18:37 26 Oct '03  
GeneralRe: OOP PineditorHeath Stewart18:50 26 Oct '03  
GeneralRe: OOP Pinmemberpjutard2:16 27 Oct '03  
GeneralRe: OOP Pinmemberalpy8:09 26 Mar '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 26 Oct 2003
Article Copyright 2003 by pjutard
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid