Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
help with Sending e-mail with CDOSYS
Old 09-13-2006, 04:59 PM help with Sending e-mail with CDOSYS
Skilled Talker

Posts: 60
Name: tami
Trades: 0
i have a script that i cant find anything wrang with it but it isnt working:
Code:
<%@language=vbScript codepage=1255%>
<% 
response.buffer="true"
FirstName=request("name")
LastName=request("LastName")
Address=request("Address")
City=request("City")
TelArea=request("TelArea")
TelNumber=request("TelNumber")
CellArea=request("CellArea")
CellNumber=request("CellNumber")
Comments = request("comments")
email=request("email")
body = "First Name:"&FirstName&"<br>Last Name:"&LastName
body = "Address:"&Address&"<br>City:"&City
body = "Tel:"&TelCountry&"-"&TelArea&"-"&TelNumber&"<br>Fax:"&FaxCountry&"-"&FaxArea&"-"&FaxNumber
body = "Mobile Phone:"&CellCountry&"-"&CellArea&"-"&CellNumber&"<br>"
body = "eMail:"&email&"<br>Comments:" & Comments
Set Jmail = Server.CreateOBject( "CDO.Message" )
JMail.Subject = "From didjFestival Site"
JMail.From = FirstName
Jmail.To="name@gmail.com"
JMail.TextBody = body
Jmail.Send
Set JMail = Nothing
'response.redirect "thankYou.htm"
%>
This page is being activated by an asp page that is a form and there i have the line:
Code:
<form method="POST" action="formProcessor2.asp">
and it doesnt send any mail and dosent redirect to the thankyou page
is this question to long?
can anybody help me?
pizza is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-13-2006, 06:02 PM Re: help with Sending e-mail with CDOSYS
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
there are a few parameters missing and you seem to be sending HTMLMail in the TextBody.

This is the function I use for sending HTML mail with CDOSYS
Code:
function CDOSYSHTMLMail(strMailFrom,strMailTo,strMailSubject,strMailMessage)
dim iConf
dim Flds
dim objNewMail
	        Set iConf = Server.CreateObject ("CDO.Configuration")
        	Set Flds = iConf.Fields 
        Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
	    Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
		Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
		Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = strSMTPUser
		Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strSMTPPassword
        	Flds.Update
	        Set objNewMail = Server.CreateObject("CDO.Message")
        	Set objNewMail.Configuration = iConf
        	Err.Clear 
		objNewMail.To = strMailTo
		objNewMail.From = strMailFrom 
		objNewMail.Subject = strMailSubject
		objNewMail.HTMLBody =  strMailMessage
        	On Error Resume Next
		objNewMail.Send
		If Err <> 0 Then 
		' add in some error messages.
		CDOSYSMail = Err
		else
		CDOSYSMail = -1
		end if 
		set Flds = nothing
		set iConf = nothing
		Set objNewMail = nothing
end function
the cdoConstants Programming Articles - Code - ASP - Vbscript Constants - CDO Constants are here

strMailServer, strSMTPUser, strSMTPPassword should be initialised to suit your mail server.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-14-2006, 03:20 AM Re: help with Sending e-mail with CDOSYS
Skilled Talker

Posts: 60
Name: tami
Trades: 0
i still have a question: do i need to replace the function with this?:
Code:
Set myMail=CreateObject("CDO.Message")
myMail.Subject="From didjFestival Site"
myMail.From=name
myMail.To="name@name.com"
myMail.TextBody=Body
myMail.Send
set myMail=nothing
and if i use the the function where do i add the :
Code:
response.redirect "thankYou.htm"
and where to i set the strMailTo with the mail i want?
thanks
pizza is offline
Reply With Quote
View Public Profile
 
Old 09-14-2006, 03:50 AM Re: help with Sending e-mail with CDOSYS
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use
Code:
sent = CDOSYSHTMLMail("me@here.com","them@there.com","Mail from us","body of message") 
if sent = -1 then
     ' message sent ok
else
     ' there was an error and handle accordingly
end if



Quote:
and where to i set the strMailTo with the mail i want?
In the call to the function
Code:
CDOSYSHTMLMail("me@here.com","them@there.com","Mail from us","body of message")
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-14-2006, 05:31 AM Re: help with Sending e-mail with CDOSYS
Skilled Talker

Posts: 60
Name: tami
Trades: 0
the truth is i am not a programmer and i am afraid i created a mass out of your function:
Code:
<%@language=vbScript codepage=1255%>
<% 
smtp_server_address = "mail.tamisivan.com"
response.buffer="true"
mailserver="mail.bezeqint.net:25"
name=request("name")
LastName=request("LastName")
Address=request("Address")
City=request("City")
TelArea=request("TelArea")
TelNumber=request("TelNumber")
CellArea=request("CellArea")
CellNumber=request("CellNumber")
Comments = request("comments")
email=request("email")
body = "First Name:"&name & vbcrlf&"Last Name:"&LastName & vbcrlf&"Company:"&Company & vbcrlf&"Conference Name:"&ConfName& vbcrlf //בשורה אחת
body = body &"Address:"&Address & vbcrlf&"City:"&City & vbcrlf&"Postal Code:"&postal & vbcrlf&"Country:"&Country & vbcrlf
body = body &"Tel:"&TelCountry&"-"&TelArea&"-"&TelNumber & vbcrlf&"Fax:"&FaxCountry&"-"&FaxArea&"-"&FaxNumber & vbcrlf
body = body &"Mobile Phone:"&CellCountry&"-"&CellArea&"-"&CellNumber & vbcrlf
body = body &"eMail:"&email&"Comments:" & Comments
strMailSubject="From didjFestival Site"
strMailFrom="From didjFestival Site"
strMailTo="sivant@netvision.net.il"
strMailMessage=body
function CDOSYSHTMLMail(strMailFrom,strMailTo,strMailSubject,strMailMessage)
dim iConf
dim Flds
dim objNewMail
         Set iConf = Server.CreateObject ("CDO.Configuration")
         Set Flds = iConf.Fields 
        Flds("http://schemas.microsoft.com/cdo/con...tion/sendusing") = cdoSendUsingPort
     Flds("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = strMailServer
  Flds("http://schemas.microsoft.com/cdo/con...tpauthenticate") = cdoBasic
  Flds("http://schemas.microsoft.com/cdo/con...n/sendusername") = strSMTPUser
  Flds("http://schemas.microsoft.com/cdo/con...n/sendpassword") = strSMTPPassword
         Flds.Update
         Set objNewMail = Server.CreateObject("CDO.Message")
         Set objNewMail.Configuration = iConf
         Err.Clear 
objNewMail.To = strMailTo
  objNewMail.From = strMailFrom 
  objNewMail.Subject = strMailSubject
  objNewMail.HTMLBody =  strMailMessage
         On Error Resume Next
  objNewMail.Send
  sent = CDOSYSHTMLMail("sivant@netvision.net.il","them@there.com","Mail from us","body of message") 
if sent = -1 then
     response.redirect "thankYou.htm"
else
     ' there was an error and handle accordingly
end if
  
  set Flds = nothing
  set iConf = nothing
  Set objNewMail = nothing
end function
%>
i was told that what i need is very simple and i should do it myself ' so i am struggeling with it......
pizza is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to help with Sending e-mail with CDOSYS
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18596 seconds with 12 queries