Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending an e-mail!

Status
Not open for further replies.

Maximus007

Technical User
Jul 26, 2004
248
US
I am try to have some fields send via e-mail when a form is submitted. the code is in the confirmation page. Can anyone give me some idea on why it's not sending an e-mail?

thank you

<%

Dim strEscalation_Type, strCae_Name, strSupervisor_Name

strEscalation_Type = Trim(Request.form("Escalation_Type"))
strCae_Name = Trim(Request.form("Cae_Name"))
strSupervisor_Name = Trim(Request.form("Supervisor_Name"))

if (strEscalation_type <> "" and strCae_Name <> "" and strSupervisor_Name <> "") Then


Dim myMail

Set myMail=CreateObject("CDO.Message")
myMail.Subject= "Sending email with CDO"
myMail.From= "Form" & strEscalation_Type
myMail.To= "martin, ralph" & "ralph_martin@cable.comcast.com"
myMail.TextBody= "This is a message for you." & strCae_Name
myMail.Send

end if
%>
 
' create mail objects
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = "me@web.co.uk"
objMail.Subject = "Message"
objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.To = "you@web.co.uk"
objMail.Body = strHTML
objMail.Send
set objMail = nothing
close.rsEmail
set rsEmail = nothing

This works for me so try this.
 
CDONTS requires that you either have windows NT/2000 or seperately istall and register the CDONTS dll on your Win XP/2003 server.

CDO.Message is the newer way of sending an email and is more appropriate because it won't break anything if your system is upgraded past 2000 (or if your already running XP/2003).

Are you getting an error message or just a failure in sending? You may need to set some of the configuration fields for the message before sending it, such as the forwarding SMTP server and such. Generally a cut down version looks something like:
Code:
Dim objCdoSys, cdoConf, cdoFlds
Set objCdoSys = Server.CreateObject("CDO.Message")
Set cdoConf = Server.CreateObject("CDO.Configuration")

set cdoFlds = cdoConf.Fields
With cdoFlds
	.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 [COLOR=green]'1 is default and means server on local machine, 2 means remote server[/color]
	.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "[highlight]mail.yourDomain.com[/highlight]" [COLOR=green]'here is the remote server we want to send through[/color]
	.Update
End With

Set objCdoSys.Configuration = cdoConf
objCdoSys.From = "[highlight]fromAddress@yourDomain.com[/highlight]"
objCdoSys.To = "[highlight]toAddress@toDomain.com[/highlight]"

objCdoSys.Subject = "[highlight]Your Email Subject Here[/highlight]"
objCdoSys.TextBody = "[highlight]Your Body Here[/highlight]"
objCdoSys.Fields("urn:schemas:httpmail:importance").Value = 1
objCdoSys.Fields.Update()
objCdoSys.Send()

Set objCdoSys = Nothing

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
Need an expensive ASP developer in the North Carolina area? Feel free to let me know.
 
Hello Maximus007, did you ever get this to work. If so will you share a dummy copy with me, I am having the very same issue and can not make the email to work. Thanks in advance for your help.

BLB[elephant2] - Always Grateful
A good friend will bail you out of jail. A true friend will be sitting at your side saying, &quot;Boy - didn't we have fun?&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top