jMail - DotNet Email Component
jMail is a DotNet email component intended to simplify the process of
sending SMTP mail from a web site.
The primary reason why I use this component is that my hosting service
has some restrictions on their SMTP service, intended to foil spammers. Those
restrictions prevent me from sending emails via my hosted SMTP service from
my development machine, making it difficult to test and debug emails, particularly
those containing HTML content.
GoDaddy's hosting service, however, has a different approach: They use authenticated
SMTP. So, by using jMail, I'm able to send emails via GoDaddy from my development
box, but the emails are sent via my hosting provider from my production sites.
Another reason for using jMail is that it simplifies some of the CDO email code.
Not that this code is that complex, but it is easier to say oMail.RecipientAddressList="<suzie> suz@nomail.x; <jeff> jeff@nomail.x"
than it is to build the same System.Net.Mail.MailAddress objects and add them
to the appropriate collection.
jMail is open source and the source code is available on codeplex: http://www.codeplex.com/jmail.
Documentation (courtesy of SandCastle) is here: http://www.jlion.com/docs/jmail/help.aspx
Note that jMail expects to find one of the following combinations of settings in
the application's web.config or app.config file:
<add key="JMAIL_SMTP" value="my.smtpserver.net"/>
and either
<add key="JMAIL_MODE" value="ASPMAIL"/>
or
<add key="JMAIL_UID" value="myuserid"/>
<add key="JMAIL_PWD" value="mypassword"/>
Here are some examples of jMail in action:
A simple message:
Dim oMessage As New JMail.Message
oMessage.Subject = "New Assistance Request"
oMessage.RecipientAddressList = "<suzy> suzyuser@nomail.x"
oMessage.SenderEmail = "itadministrator@nomail.x"
oMessage.Message = "Request Submitted"
Dim oSender As New JMail.SendEmail
Dim sResult As String = oSender.SendThisMessage(oMessage)
A message with an attachment
Dim oMessage As New JMail.Message
oMessage.Subject = "New Assistance Request"
oMessage.RecipientAddressList = "<suzy> suzyuser@nomail.x"
oMessage.SenderEmail = "itadministrator@nomail.x"
oMessage.Message = "Request Submitted"
oMessage.AttachmentFile="c:\myfile.doc"
Dim oSender As New JMail.SendEmail
Dim sResult As String = oSender.SendThisMessage(oMessage)