www.webdeveloper.com
Results 1 to 4 of 4

Thread: Multiple mail send problems

  1. #1
    Join Date
    Sep 2005
    Posts
    16

    Multiple mail send problems

    Hi,
    I am creating a form that when submitted, sends out two emails. I have written the following code for this task:


    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <%
    Dim senderName, senderEstablish, senderEmail

    senderName = Request.Form("NameInput")
    senderEstablish = Request.Form("establishInput")
    senderEmail = Request.Form("emailInput")
    %>

    <%
    Dim objMail
    Set objMail = CreateObject("CDONTS.NewMail")
    objMail.BodyFormat = 0 'HTML=0;Text=1
    objMail.MailFormat = 0 'Mime=0;Text=1 (Encoding)
    objMail.From = senderEmail 'sender
    objMail.To = "things@stuff.com" 'recipient
    objMail.Subject = "Testing!"
    objMail.Body = "<b>Name: </b>"&senderName&"<br><br>"&_
    "<b>Establishment: </b>"&senderEstablish&"<br><br>"&_
    "<b>Email: </b>"&senderEmail&"<br><br>"
    objMail.Send
    Set objMail = nothing

    Set objMail = CreateObject("CDONTS.NewMail")
    objMail.BodyFormat = 0 'HTML=0;Text=1
    objMail.MailFormat = 0 'Mime=0;Text=1 (Encoding)
    objMail.From = "things@stuff.com"
    objMail.To = senderEmail 'recipient
    objMail.Subject = "Testing"
    objMail.Body = "<b>Name: </b>"&senderName&"<br><br>"&_
    "<b>Establishment: </b>"&senderEstablish&"<br><br>"&_
    "<b>Email: </b>"&senderEmail&"<br><br>"
    objMail.Send
    Set objMail = nothing
    Response.Redirect "thanks.asp"
    %>

    Only one of these mails will send and its always the second one (even if i swap the two mails round in the code!).

    Can anybody see why this might be happening

  2. #2
    Join Date
    Jun 2005
    Location
    WI, US
    Posts
    188
    what are you trying to accomplish with this code? send a message to someone and a copy to yourself? you could use a CC or BCC for that

    otherwise, try changing the 2nd block of code to objMail2 and see if that makes a difference

    eg. Set objMail2 = CreateObject(.....) and so on

  3. #3
    Join Date
    Apr 2005
    Location
    Philippines
    Posts
    92
    you can include CC and BCC..

    like this:

    Code:
    Dim objMail
    	Set objMail = Server.CreateObject("CDONTS.NewMail")
    
    	objMail.To = "email1@domain.com"
    	objMail.Cc = "email2@domain.com"
    	objMail.Bcc = "email3@domain.com"
    	objMail.From = "youremail@domain.com"
    	objMail.Subject = strSubject 
    	objMail.BodyFormat = 0 
    	objMail.MailFormat = 0 
    	objMail.Body = strHTML 
    	objMail.Send 
    
    	set objMail = nothing
    
    	Response.Redirect "thanksPage.htm"
    if theres someone to ask for, dont hesitate...

  4. #4
    Join Date
    Sep 2005
    Posts
    16
    Many thanks for responding. The problem has been fixed now and was caused by my servers SMTP settings.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles