Click to See Complete Forum and Search --> : Form mail with ASP


farshad
02-24-2004, 07:44 AM
Hi
I made a Form Mail
and i use CDOSYS so i need my SMTP server

but my Outgoing server requier Authentication

how can i show this form to use a specific user name and password
to use this mail server to send my form information

Codes for my form mail

=================================

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")


'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "may.mailserver.com"

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon

objCDOSYSMail.From = "my@mail.com"

objCDOSYSMail.To = "may@mail.com"

objCDOSYSMail.Subject = "Enquiry sent from enquiry form on website"

objCDOSYSMail.HTMLBody = strBody

objCDOSYSMail.Send


'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>

====================

Thanks

buntine
02-24-2004, 09:15 AM
You must define a few extra configuration settings.


with objCDOSYSCon
.fields(cdoSendUserName) = "username"
.fields(cdoSendPassword) = "password"
end with


The preceding code snippet should be helpful

Regard,
Andrew Buntine.

farshad
02-24-2004, 10:49 AM
Thank you so much

but how can i use this code
and where can i put it



Thanks

buntine
02-24-2004, 10:51 AM
No probs, sticking it above the 'fields.update' command should do the trick.

You pretty much just have to paste the code into your application, just be sure to change the username and password, respectively.

farshad
02-24-2004, 01:26 PM
Excuse me that I ask you many question

but

I have a username and password for my mail
and a user name and password for my Site and host
admin area

which one i must to use for this code


============================
Thank you

farshad
02-24-2004, 05:19 PM
Hi
Ii added this code
but i get this error

=============
ADODB.Fields error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/send_mail.asp, line 51

====================

my code is here :

****************************************


<%
'Dimension variables
Dim objCDOSYSCon
Dim strBody
Dim strReturnEmailAddress


'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")

'Initialse strBody string with the body of the e-mail
strBody = "<h2>E-mail sent from form on Web Site</h2>"
strBody = strBody & "<br><b>Name: </b>" & Request.Form("firstName") & " " & Request.Form("lastName")
strBody = strBody & "<br><br><b>Address: -</b>"
If (Request.Form("street1")) > "" Then
strBody = strBody & "<br> " & Request.Form("street1")
End If
If (Request.Form("street2")) > "" Then
strBody = strBody & "<br> " & Request.Form("street2")
End If
If (Request.Form("town")) > "" Then
strBody = strBody & "<br> " & Request.Form("town")
End If
If (Request.Form("county")) > "" Then
strBody = strBody & "<br> " & Request.Form("county")
End If
If (Request.Form("country")) > "--- Choose One ---" Then
strBody = strBody & "<br> " & Request.Form("country")
End IF
If (Request.Form("postCode")) > "" Then
strBody = strBody & "<br> " & Request.Form("postCode")
End If
strBody = strBody & "<br><br><b>Telephone: </b>" & Request.Form("tel")
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
strBody = strBody & "<br><br><b>Enquiry: - </b><br>" & Replace(Request.Form("enquiry"), vbCrLf, "<br>")






'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")


'Out going SMTP server

with objCDOSYSCon
.fields(cdoSendUserName) = "my username" > line 51
.fields(cdoSendPassword) = "my password"
end with


objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my mail server"

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60



objCDOSYSCon.Fields.Update


'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon

objCDOSYSMail.From = "my email address"

objCDOSYSMail.To = "my email address"

objCDOSYSMail.Subject = "Enquiry sent from enquiry form on website"

objCDOSYSMail.HTMLBody = strBody

objCDOSYSMail.Send


'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>


******************************************

what is that?


Thanks

farshad
02-24-2004, 06:13 PM
I solved the problem by entering this code
on the top of the page


==========

<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->

================

but i have a problem now
i can`t send this form mail for e-mails from MSN and HOTMAIL

=============
what do you think about this?

farshad
02-25-2004, 12:48 PM
Hey where are you?



Anybody help me?
:(