Send ASP Email VIA GMail
This is a one page self submitting form that you can
edit to look however you want.
This has some very slick built in server side form validation.
This sends the email using CDOSYS using your Gmail Account and POP3.
You can use this code on as many web sites as you like.
This is pure ASP source code so you can add or remove fields pretty easily by
looking at what is already there. This code is EXTREMELY clean and easy to
follow along with.
Click here to try the online demo
Also Check out our
Self Submitting Contact Us Form that
does not use GMail
This code works with the
CJWSoft Captcha System
Use of this code is not supported in any
Click here to try the online demo
Purpose: The purpose of using GMail to send emails is as
Various email servers on the Internet are taking a lot of
precautions to eliminate spam. They are checking Open
Relay Lists, Verifying MX Records, Incorrectly listing
your IP or email server as a spammer.. etc etc
This makes it hard to send email from ASP and a
webserver and make sure the email is actually delivered.
By using a GMail account to send the email and not your
own server or your ISP's server you are increasing the
chance that the emails actually get delivered. This is
because GMail has done everything possible to make sure
their server and everything related to them is set up
correctly and that other servers accept email sent from
The other advantage of this is that if you do not have
your own email server you can easily send emails from
Now, because we are sending an email to our own GMail
account using this code worrying about the email not
getting delivered is not so important. It is when you
start sending emails via ASP to other people's email
address's that you benefit from that. That being said,
if you are decent with ASP you can also adapt the code
in this Contact US form to use all throughout your site
so anytime you send email from ASP code you will be
using your GMail account to do so. Ensuring your
customers get your emails. I did the hard work figuring
out the code to make this all work. Dont worry about
that right now, just follow the directions below and get
the contact us form working and sending emails. After
that you should be able to adapt the GMail emailing code
for other purposes.
Adapting the code to work in your own
scripts is not supported by us .
I will also
like to add that you do not actually have to send the
results of the contact form to your GMail email account.
By editing one line of code you can send the Contact
Form results to any email address.Another REALLY COOL
thing is that all email sent via GMail from your ASP
code actually shows up in the sent box when you log into
the GMail web interface. This gives you a nice record of
all emails sent by your server. GMail gives you about 3
gb worth of email storage too which is plenty.
Get a GMail account.. it's a beta program so you have to
get an invite to get an account Search google for info
on that.. Also, if I still have invites left I can
invite you if you can't get one on your own.
Once you get a GMail account and it works log in to it.
Go to Settings: Forwarding and POP
Enable POP for all mail
Your are now ready to use this Contact Us script..
' Edit these 3 values accordingly in the "contact_us.asp"
smtpserver = "smtp.gmail.com"
youremail = "email@example.com"
yourpassword = "yourpassword"
If you run this script on a Windows IIS Webserver
supporting ASP and CDOSYS your contact us form should be
sending emails using your GMail account.
You must be a running Windows
XP/20002003 server with support for Active Server Pages
and CDOSYS. CDOSYS is on all these server versions by
You must have a Gmail Email Account. Port 465 must not
be blocked on the webserver. That is the port GMAIL uses
to do SLL via POP3. On some GODaddy servers they seem to
be blocking this port and other Hosting Companies may as
well. You never really know and it is not my
responsibility if that is the case.