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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email sending First time but not sending second time

Status
Not open for further replies.

fawaz

Programmer
Mar 3, 2001
16
IN
I am sending email taking messages from html form and addresses in access database. I am testing the script. It is sending suceSsfully first time but second time it stops at command ObjSendMail.Send. PLESE ADVISE ME TO FIX THE ISSUE.


Code:
<%@ Language=VBScript %>

<html>

<head>
<title>New Page 2</title>
</head>

</head>

<body background="file:///C:/Program%20Files/Microsoft%20FrontPage/themes/arcs/"
bgcolor="#FFFFFF" text="#000000" link="#3399FF" vlink="#3366CC" alink="#FF9900">
<!-- old command in its place Mailer.RemoteHost = "208.61.254.20"  -->
<!-- Insert HTML here -->
<% response.write("file openned") %>
<% server.scripttimeout=1200 
session.codepage=65001 'utf-8 code
 Response.CharSet = "utf-8"
%>
<%
SUB sendingMail(toWho,toname)
     response.write "now start sending mail"
     response.write towho
     response.write toname
     dim Msubject
     dim mbody
  
'Set Mailer = Server.CreateObject("SMTPsvg.Mailer") 
'Set Mailer = Server.CreateObject("CDONTS.Newmail")
'Set Mailer = Server.CreateObject("Persits.MailSender")
'Mailer.BodyPart.Charset = "UTF-8" 



'NEW CODES AFTER TRANSFER TO PHP JOOMLA SITE BY RDS 


 Dim ObjSendMail 
   Set ObjSendMail = CreateObject("CDO.Message") 
   response.write "object openned"
    
   'This section provides the configuration information for the remote SMTP server. 
    
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 'Send the message using the network (SMTP over the network). 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] ="64.62.254.135" 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpusessl")[/URL] = False 'Use SSL for the connection (True or False) 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")[/URL] = 60
    
   ' authentication 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = 1 'basic (clear-text) authentication 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] ="vasu@ramadevisoftware.com" 
   ObjSendMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] ="VASUKARUNA" 
    
   ObjSendMail.Configuration.Fields.Update 
    
   'End remote SMTP server configuration section== 
   response.write "configuration over     "
   mBody =Request.form ("messages") & VbCrLf & " " & request.form("username") & " " & request.form("usercity") & VbCrLf & _
 "Message sent through [URL unfurl="true"]http://www.madukkur.com"[/URL]
 msubject = Request.form ("usersubject")
    response.write mbody
  ' ObjSendMail.To = towho
  response.write towho&VbCrLf 
   objsendmail.to="eshackmkr@gmail.com"
   ObjSendMail.Subject = "msubject"
      response.write msubject & VbCrLf 
  ' ObjSendMail.From = Request.form ("Useremail") 
     ObjSendMail.From = "vasu@ramadevisoftware.com" 
         ' we are sending a text email.. simply switch the comments around to send an html email instead 
   'ObjSendMail.HTMLBody = "this is the body" 
  ' ObjSendMail.TextBody = mbody
    objsendmail.textBody="We are testing our website; please ignore" & VbCrLf 
    response.write objsendmail.textBody
   ObjSendMail.Send 
   response.write "message sent"
   'if ObjSendMail.Send then 
'Response.Write "Your Mail has been Sent to "  & toname & VbCrLf 
' else 
'Response.Write "Mail send failure. Error was " & VbCrLf 
'end if 

    
   Set ObjSendMail = Nothing

' END NEW CODE AFTER TRANSFER TO PHP JOOMLA SITE BY RDS 



'mailer.MailFormat = 0
'mailer.SetLocaleIDs(65001)
'Mailer.CharSet = "UTF-8"
 'Mailer.ContentTransferEncoding = "Quoted-Printable"
'Mailer.FromName = Request.form ("Username")
'Mailer.From= Request.form ("Useremail") 
'Mailer.RemoteHost = "smtp.rdsindia.com" 
'Mailer.to=towho
'msubject = Request.form ("usersubject")
'response.write(towho)
'msubject = String(msubject.getBytes(8859_1),"UTF8")
'Mailer.Subject =msubject
'mBody =Request.form ("messages") & VbCrLf & " " & request.form("username") & " " & request.form("usercity") & VbCrLf & _
' "Message sent through [URL unfurl="true"]http://www.madukkur.com"[/URL]
'Mailer.Body =mbody 
'mailer.send
'if Mailer.Send then 
'Response.Write "Your Mail has been Sent to " & toname
' else 
'Response.Write "Mail send failure. Error was " 
'end if 
'set mailer=nothing
END SUB %>
<!-- open records -->
<%
sub Openrecord(sqlcommand)
 Set RS = Con.Execute(sqlcommand)

While not RS.EOF 
response.write "file being openned"
towho=rs("email")
toname=rs("name")
towho=trim(towho)
sendingmail towho,toname
RS.MoveNext
Wend
RS.CLOSE
SET RS=NOTHING
end sub %>

<p>--&gt; <!--  Open database --> <%

path = Request.ServerVariables("APPL_PHYSICAL_PATH")
'response.write(path)
path = path&"db\biodata.mdb"
response.write(path)
' path="/madukkur/madukkur.com/db/biodata.mdb"
set con =server.createobject("ADODB.Connection")
'con.connectionstring="Provider=microsoft.jet.oledb.4.0;" & _
'"data source = '"&path&"';"
con.connectionstring="Provider=microsoft.jet.oledb.4.0;" & _
"data source = 'd:\Inetpub\vhosts\madukkur.com\httpdocs\db\biodata.mdb'"

'con.connectionstring="Provider=microsoft.jet.oledb.4.0;" & _
'"data source = 'd:\hshome\madukkur\madukkur.com\db\biodata.mdb'"


con.open 
Response.Write "Your Message is being sent to all members....."
openrecord "select * from all_add where [email] <>' '"
'Response.Write "Your Message is being sent to UAE......"
'openrecord "select * from [UAE_add] where [e-mail] <>' '"
'Response.Write "Your Message is being sent to USA....."
'Openrecord "select * from USA_add where [e-mail] <>' '"
'Response.Write "Your Message is being sent to Bahrain......"
'Openrecord "select * from bah_add where [e-mail] <>' '"
'Response.Write "Your Message is being sent to Singapore....."
'Openrecord "select * from sing_add where [e-mail] <>' '"
'Response.Write "Your Message is being sent to UK....."
'Openrecord "select * from UK_add where [e-mail] <>' ' "
' Response.Write "Your Message is being sent to India....."
'Openrecord "select * from Madu_add where [e-mail] <>' ' "
Response.Write "Thanks- your Message sent to our members"
CON.CLOSE
SET CON=NOTHING
 %> </p>
</body>
</html>

E N D C O D E 


my message form codes:test_msgtoall070608.asp

<%@ Language=VBScript %>
<%
 session.codepage=65001 'utf-8 code
 Response.CharSet = "utf-8"
dim comments,username,useremail,usercity,usercountry
comments=TRIM(request.form("comments"))
username=trim(request.form("username"))
useremail=trim(request.form("useremail"))
usercity=trim(request.form("usercity"))
usersubject=trim(request.form("usersubject"))
%>
<% 
Dim strUserName		'Holds the users username
Dim strEmail 		'Holds the users email
Dim strPassword		'Holds the user password
Dim blnAutoLogin	'Set to true if the user wants auto login
Dim blnEmailFound	'Set to false if the email is not found
Dim blnPasswordOK	'Set to false if the password is incorrect
Dim strUserID		'Hold the users ID
Dim strSaltValue	'Holds the salt value for password
'strEmail = Trim(Mid(LCase(Request("email")), 1, 50))
'response.write ("eshack")
'RESPONSE.WRITE(strEmail)
'if strEmail = "" then
'Response.Clear
'Response.write "Invalid Access"
'Response.write "You must be a registered member and must have user right for posting."
'Response.write "   Send email: eshack@madukkur.com after registering your name for posting right."
'Response.End
'end if
 %>

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="[URL unfurl="true"]http://www.w3.org/TR/REC-html40">[/URL]

<head>
<title>Broadcast Message</title>
<meta name="Microsoft Theme" content="none">
<link rel="File-List" href="test_msgtoall070608_files/filelist.xml">

<!--[if !mso]>
<style>
v\:*         { behavior: url(#default#VML) }
o\:*         { behavior: url(#default#VML) }
.shape       { behavior: url(#default#VML) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
</head>

<body bgcolor="#F8A67E">

<p><!--[if gte vml 1]><v:shapetype id="_x0000_t202"
 coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe">
 <v:stroke joinstyle="miter"/>
 <v:path gradientshapeok="t" o:connecttype="rect"/>
</v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t202" alt="" style='position:absolute;
 left:391.5pt;top:128.25pt;width:208.5pt;height:136.5pt;z-index:1' fillcolor="#fc9"
 strokecolor="red">
 <v:textbox>
<table cellspacing="0" cellpadding="0" width="260" height="100%">
	<tr>
		<td align="center" width="260">
		<p align="left">Please use unicode font for posting your messages.&nbsp; 
		Please click here to download compatible&nbsp;
		<a href="[URL unfurl="true"]http://www.madukkur.com/saiIndira-font-installer.zip">Tamil[/URL] 
		Font</a>. Please click here to open&nbsp;
		<a href="[URL unfurl="true"]http://www.madukkur.com/transliteration.htm">Transliteration</a>[/URL] 
		page to type, copy and paste the text.</td>
	</tr>
</table>
 </v:textbox>
</v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout;position:
absolute;z-index:1;left:521px;top:170px;width:284px;height:188px'><img
width=284 height=188 src="test_msgtoall0706089_files/image001.gif" v:shapes="_x0000_s1025"></span><![endif]><font color="#0000FF">Dear Madukkurians,</font></p>

<p><strong><font color="#0000FF">P L E A S E&nbsp;&nbsp; P O S T&nbsp; Y O U R&nbsp; 
M E S S A G E&nbsp; TO SEND EMAIL TO MEMBERS </font></strong></p>

<form method="post" action="test_msgtosend070608.asp">
  <input type="hidden" name="usersubject_req" value="You must enter your subject."><input
  type="hidden" name="Messages_req" value="You must enter your message."><input
  type="hidden" name="username_req" value="You must enter your name."><input type="hidden"
  name="usercity_req" value="You must enter city name."><input type="hidden"
  name="formScript" value="<%=Request.ServerVariables("SCRIPT_NAME")%>"><p><font
  color="#0000FF">Enter your messages in the space provided below</font>:</p>
  <p><font color="#0000FF">Subject</font> <input type="text" size="35" maxlength="256"
  name="Usersubject" value="<%=Server.HTMLEncode( usersubject)%>"> <dl>
    <dd><textarea name="Messages" rows="5" cols="50"><%=Server.HTMLEncode( comments )%></textarea></dd>
  </dl>
  <p><font color="#0000FF"><strong>Please Type Your Address:</strong></font><br>
  &nbsp; <font color="#0000FF">Name</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
  type="text" size="35" maxlength="256" name="Username"
  value="<%=Server.HTMLEncode( Username )%>"><br>
  &nbsp; <font color="#0000FF">E-mail</font>&nbsp;&nbsp;&nbsp;&nbsp; <input type="text"
  size="35" maxlength="256" name="UserEmail" value="<%=Server.HTMLEncode( useremail)%>"><br>
  &nbsp; <font color="#0000FF">City</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input
  type="text" size="35" maxlength="256" name="Usercity"
  value="<%=Server.HTMLEncode(usercity)%>"> </p>
  <p><input type="submit" value="Send e-mail"> <input type="reset" value="Clear Form"></p>
</form>

<hr align="center">

<p>Forms:copyright maddukkur.com</p>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top