Sending e-mail from a ASP form

G

Greg Maxey

I have a user feedback form on my website that sends the e-mail to my
mvps.org e-mail account. I use this code in the .ASP file:

'create the email and send it
Set myMail=CreateObject("CDO.Message")

Mymail.From= UserEmail
Mymail.To= "(e-mail address removed)" 'change to your email
Mymail.Subject= "Website Feedback from " & Username

MyBody = "Message Type: " & MessageType & vbCrLf & vbCrLf
MyBody = MyBody & "Subject: " & Subject & vbCrLf & vbCrLf
MyBody = MyBody & "Subject Other: " & SubjectOther & vbCrLf & vbCrLf
MyBody = MyBody & "Comments: " & Comments & vbCrLf & vbCrLf
MyBody = MyBody & "Username: " & Username & vbCrLf & vbCrLf
MyBody = MyBody & "UserEmail: " & UserEmail & vbCrLf & vbCrLf
MyBody = MyBody & "ContactRequested: " & ContactRequested & vbCrLf
myMail.TextBody= MyBody

'Configure the server

Const cdoSchema = "http://schemas.microsoft.com/cdo/configuration/"
Mymail.Configuration.Fields.Item(cdoSchema & "sendusing") = 2
Mymail.Configuration.Fields.Item(cdoSchema & "smtpserver") = "mail.mvps.org"
'change to your server
Mymail.Configuration.Fields.Item(cdoSchema & "smtpserverport") = 25
Mymail.Configuration.Fields.Update

I would like to start using my gmail account for this purpose. I changed
the following three lines as show but I get an error about a connection to
the server when I try to implement it.

Mymail.To= "(e-mail address removed)"
Mymail.Configuration.Fields.Item(cdoSchema & "smtpserver") =
"smtp.gmail.com"
Mymail.Configuration.Fields.Item(cdoSchema & "smtpserverport") = 465

I got the values for smtp server and serverport from a web pages describing
how to set up OE to send and recieve gmail. I don't know the meaning of the
"sendusing" value.

Thanks.
 
R

Ronx

Leave
Mymail.Configuration.Fields.Item(cdoSchema & "smtpserver") =
"mail.mvps.org"
and
Mymail.Configuration.Fields.Item(cdoSchema & "smtpserverport") = 25
as in original. The form uses the mvps.org email server to send the
email.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp

FrontPage Support: http://www.frontpagemvps.com/
 
G

Greg Maxey

Ron,

I had tried that previously. I just changed:
Mymail.To= "(e-mail address removed)"
to
MymailTo= "(e-mail address removed)"

That causes this error:

error '8004020f'
/Response.asp, line 138
 
R

Ronx

The SMTP server at mvps.org may be set to not relay messages from forms
to other domains. This is a common set up for web hosts in their fight
against spam.
This means that you are restricted to sending mail to your mvps.org
account. You could ask mvps admin for advice on this.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp

FrontPage Support: http://www.frontpagemvps.com/
 
G

Greg Maxey

Ron,

Thanks.

I am not sure I understand fully. Is it because my website is posted on the
mvps.org server that I have to use:

Mymail.Configuration.Fields.Item(cdoSchema & "smtpserver") = "mail.mvps.org"

and

Mymail.Configuration.Fields.Item(cdoSchema & "smtpserverport") = 25 ?


My real goal is not to have my personal e-mail address visible on my web
page. Suggestions?
 
R

Ronx

The email address will not be visible in the page users see - the asp
code is translated by the server, some of it becomes HTML that will be
visible, some is never visible. You have to use the mvps SMTP servers
since that is where your website is located.
I use the same (or similar) coding at
http://www.rxs-enterprises.org/feedback/ You can hunt for an email
address on that page and won't find one.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp

FrontPage Support: http://www.frontpagemvps.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top