You are here: Portal Home > Knowledgebase > Email > Sending email from a webpage using CDO
Please Login

Sending email from a webpage using CDO

 

Sample code for using CDO to send email from a webpage.

 

Const cdoSendUsing = 2 'Send the message using the network (SMTP over the network).
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = Server.CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.Sender = "me@mydomain.com"
objMessage.From = "me@mydomain.com"
objMessage.To = "recipient@test.com"
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mydomain.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "me@mydomain.com"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

objMessage.Configuration.Fields.Update
objMessage.Send

Note :
Change the SMTP Server with your mail.your-actual-domain.com
Username --> Change with your email account in this format (email@domain.com).
Password-> Your email password.

 



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
RoundCube series (Views: 247)

Client Login

best hosting
Remember Me  

Search

uk web hosting

managed server
 
All Content © 2000-2011 Fast2host Limited. All Rights Reserved.
UK Company Registration Number: 05348700VAT Number: GB 884 9830 61 — BGP4 Network AS48825

Fast2host provides the best in hosting. Should you find that our services do not meet your specifications, we offer a full refund, providing your service cancellation is made within 30 days of opening your account. (The 30 day guarantee applies to Shared Hosting Solutions, for other solution guarantees please see 30 Day Money Back Guarantee.)

With the latest cloud VPS technology and infrastructure located in the UK, within our own datacenter, we can help your business thrive on the internet. Fast2host can setup and host sites whatever your hosting needs. Whether you're just establishing a presence on the internet, or you want to manage, maintain and monitor an eBusiness web hosting solution, we can help.

This is what makes Fast2host different, we provide a unique web hosting service for each client, including adult web hosting, providing close contact and support to create 100% satisfaction. We are here to help and support you throughout.

A dedicated server can be rebooted remotely. Cloud vps hosting allows you to reinstall OS instantly. Cpanel hosting you can restore files yourself. 100% White Label Reselling hosting you can make money today.