Classic ASP sending email with SMTP Authentication

Google

Hello,

If you would like to send mails using SMTP authentication for your ASP site, then the below content will help you to send authenticated mail.

~~~~~~~~~

<%
Dim ObjSendMail
Set ObjSendMail = CreateObject(CDO.Message)

‘Configuration for remote SMTP server

‘Network Send
ObjSendMail.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/sendusing) = 2

‘Name of SMTP server
ObjSendMail.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/smtpserver) =

‘SMTP port
ObjSendMail.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/smtpserverport) = 25

‘MaxESP SMTP servers require authentication

‘Basic Authentication
ObjSendMail.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/smtpauthenticate) = 1

‘SMTP username as configured in the control panel
ObjSendMail.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/sendusername) =

‘SMTP user password as configured in the control panelObjSendMail.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/sendpassword) =

ObjSendMail.Configuration.Fields.Update

‘Configuration for email message

‘Email To address
ObjSendMail.To =

‘Email Subject
ObjSendMail.Subject = Subject Content

‘Email From address
ObjSendMail.From =

‘Email Body
ObjSendMail.TextBody = Body Content

ObjSendMail.Send

Set ObjSendMail = Nothing
%>

~~~~~~~~~

Note: In above mentioned code,
replace with your server name for e.g. (domain.com or mail.domain.com),
with your user name for e.g. (test@domain.com),
replace with your password,
replace with the mail id of the receiver.

Thank you.

Powered by Facebook Comments

Be the first to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.