Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automated Email Response on Send Mail

    Hi,

    i am using an asp script to receive the emails of subscribers.

    Do you know of any script that, on receipt of an email automatically sends a reply (a preset html email), including 'Dear Name,' (if the email is name@domain.com) where specified -
    maybe with the [NAME] tag?

    all comments are greatly appreciated.

    DHTMLHELP

  • #2
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    You mean an auto-responder type thing.
    Omnis mico antequam dominus Spookster!

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Correct.

    If for example a user submits his email (hisname@hisdomain.com) to orders@mydomain.com he receives an automated reply (a custom html email) in the form of:

    Dear Hisname,

    etc.


    if the emails is sent to apples@mydomain.com, Hisname would receive apple.html, write to oranges@mydomain.com and you would receive oranges.html.


    is this something that has been done before (without the oranges and apples maybe ).

    DHTMLHELP

  • #4
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Ok lol, I see hmm... Well I'm only new to asp but I imagine that it would got a little like:

    Code:
    <html>
    <head>
    </head>
    <body>
    <% if request.QueryString("domain") = "apples" then
    autoresponse = "apples"
    
    else if request.QueryString("domain")  = "oranges" then
    autoresponse = "oranges"
    
    dim EmailText
    EmailText = "Dear & hisname &" 
    dim SendEmail
    SendEmail = autoresponse
    dim EmailFrom
    EmailFrom = " & autoresponse & @mydomain.com"
    dim myMail
    
    If SendEmail = autoresponse then
        Set myMail = CreateObject("CDONTS.NewMail") 
    		myMail.From = EmailFrom		
    		myMail.To = Request.Form("FruitForm") 
    		myMail.Subject = autoresponse
    		
            myMail.Body = EmailText
    		myMail.Send
    		Set myMail = Nothing
    end if		
    end if
    end if %>
    </body>
    </html>
    Last edited by Mhtml; 07-24-2002 at 11:22 AM.
    Omnis mico antequam dominus Spookster!

  • #5
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Originally posted by Mhtml
    Code:
    <html>
    <head>
    </head>
    <body>
    <% if request.QueryString("domain") = "apples" then
    autoresponse = "apples"
    
    else if request.QueryString("domain")  = "oranges" then
    autoresponse = "oranges"
    
    dim EmailText
    EmailText = "Dear " & hisname 
    dim SendEmail
    SendEmail = autoresponse
    dim EmailFrom
    EmailFrom = autoresponse & "@mydomain.com"
    dim myMail
    
    If SendEmail = autoresponse then
        Set myMail = CreateObject("CDONTS.NewMail") 
    		myMail.From = EmailFrom		
    		myMail.To = Request.Form("FruitForm") 
    		myMail.Subject = autoresponse
    		
            myMail.Body = EmailText
    		myMail.Send
    		Set myMail = Nothing
    end if		
    end if
    end if %>
    </body>
    </html>
    [/B]
    I tweaked it a tad. And fixed some syntax errors.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well I feel a little more confused, but I guess it's a very good sign.

    On my site a visitor has the option to order each product by simply imputing their email address. Each submit form is run by an asp script I have included at the end of this post.

    My question is how can I integrate what you posted with this script, or can I customise the script I am currently using to send an automated email to the submitter?

    DHTMLHELP



    <%
    'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
    Response.Buffer = True

    'Dimension variables
    Dim strBody 'Holds the body of the e-mail
    Dim objCDOMail 'Holds the mail server object
    Dim strMyEmailAddress 'Holds your e-mail address
    Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
    Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
    Dim strReturnEmailAddress 'Holds the return e-mail address of the user


    '----------------- Place your e-mail address in the following sting ----------------------------------

    strMyEmailAddress = "sales@domain.com"

    '----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------

    strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail

    '----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------

    strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail

    '-----------------------------------------------------------------------------------------------------


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


    'Initialse strBody string with the body of the e-mail
    strBody = "<h2>Test Header</h2>"
    strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress


    'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
    If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then

    'Set the return e-mail address to your own
    strReturnEmailAddress = strMyEmailAddress
    End If


    'Send the e-mail

    'Create the e-mail server object
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
    objCDOMail.From = "<" & strReturnEmailAddress & ">"

    'Who the e-mail is sent to
    objCDOMail.To = strMyEmailAddress

    'Who the carbon copies are sent to
    objCDOMail.Cc = strCCEmailAddress

    'Who the blind copies are sent to
    objCDOMail.Bcc = strBCCEmailAddress

    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0

    'Set the subject of the e-mail
    objCDOMail.Subject = "Test Title"

    'Set the main body of the e-mail
    objCDOMail.Body = strBody

    'Importance of the e-mail (0=Low, 1=Normal, 2=High)
    objCDOMail.Importance = 1

    'Send the e-mail
    objCDOMail.Send

    'Close the server object
    Set objCDOMail = Nothing
    %>
    <html>
    <head>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <title>Test</title>

    </head>


    <body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099" alink="#FF0000">
    <br>

    </body>


    </html>

  • #7
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Hmmm, doesn't that script work?

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Oracleguy,

    it does work but it doesn't do everything I would like it to do.

    The script I have posted sends me an email with the email address of the person requesting the product and the item desired.

    What i would also like the script to do is automatically send a reply to the submitter with details on how to complete the transaction; this without having to setup an autoresponder.

    Is this possible.

    DHTMLHELP

  • #9
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    I'll have a go at combining them but I can't promise anything because as I said before I've only been learning for a week.
    Last edited by Mhtml; 07-26-2002 at 05:53 AM.
    Omnis mico antequam dominus Spookster!

  • #10
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    But from what I can see it would go a little like this:

    Code:
    <% 
    'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser 
    Response.Buffer = True 
    
    'Dimension variables 
    Dim strBody 'Holds the body of the e-mail 
    Dim objCDOMail 'Holds the mail server object 
    Dim strMyEmailAddress 'Holds your e-mail address 
    Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail 
    Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail 
    Dim strReturnEmailAddress 'Holds the return e-mail address of the user 
    Dim strAutoEmailAddress 'Holds e-mail address of the user for Auto Responder
    
    '----------------- Place your e-mail address in the following sting ---------------------------------- 
    
    strMyEmailAddress = "sales@domain.com" 
    
    '----------- Place Carbon Copy e-mail address's in the following sting, separated by ; -------------- 
    
    strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail 
    
    '----------- Place Blind Copy e-mail address's in the following sting, separated by ; -------------- 
    
    strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail 
    
    '----------------------------------------------------------------------------------------------------- 
    
    
    'Read in the users e-mail address 
    strReturnEmailAddress = Request.Form("email") 
    
    
    'Initialse strBody string with the body of the e-mail 
    strBody = "<h2>Test Header</h2>" 
    strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress 
    
    
    'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected 
    If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then 
    
    'Set the return e-mail address to your own 
    strReturnEmailAddress = strMyEmailAddress 
    End If 
    
    '---------------------------------Auto Response Information Added by Mhtml-------------------------
    'Set the users e-mail address
    strAutoEmailAddress = strReturnEmailAddress
    
    'set auto response body
    strAutoBody = "Thank you for you order.<br><font color=(ff0000)>This is an automated response please do not reply to this e-mail</font>"
    '----------------------------------------------END AUTO RESPONSE---------------------------------
    
    'Create the e-mail server object 
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail") 
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent) 
    objCDOMail.From = "<" & strReturnEmailAddress & ">" 
    
    'Who the e-mail is sent to 
    objCDOMail.To = strMyEmailAddress 
    
    'Who the carbon copies are sent to 
    objCDOMail.Cc = strCCEmailAddress 
    
    'Who the blind copies are sent to 
    objCDOMail.Bcc = strBCCEmailAddress 
    
    'Set the e-mail body format (0=HTML 1=Text) 
    objCDOMail.BodyFormat = 0 
    
    'Set the subject of the e-mail 
    objCDOMail.Subject = "Test Title" 
    
    'Set the main body of the e-mail 
    objCDOMail.Body = strBody 
    
    'Importance of the e-mail (0=Low, 1=Normal, 2=High) 
    objCDOMail.Importance = 1 
    
    'Send the e-mail 
    objCDOMail.Send 
    
    'Close the server object 
    Set objCDOMail = Nothing 
    
    '-------------------------------------------------------AUTO RESPONDER ADDED BY Mhtml------------
    
    'Create the e-mail server object 
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail") 
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent) 
    objCDOMail.From = "<" & strMyEmailAddress & ">" 
    
    'Who the e-mail is sent to 
    objCDOMail.To = strAutoEmailAddress 
    
    
    'Set the e-mail body format (0=HTML 1=Text) 
    objCDOMail.BodyFormat = 0 
    
    'Set the subject of the e-mail 
    objCDOMail.Subject = "Auto Response to order submission" 
    
    'Set the main body of the e-mail 
    objCDOMail.Body = strAutoBody 
    
    'Importance of the e-mail (0=Low, 1=Normal, 2=High) 
    objCDOMail.Importance = 1 
    
    'Send the e-mail 
    objCDOMail.Send 
    
    'Close the server object 
    Set objCDOMail = Nothing 
    
    
    
    %> 
    <html> 
    <head> 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
    <title>Test</title> 
    
    </head> 
    
    
    <body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099" alink="#FF0000"> 
    <br> 
    
    </body> 
    
    
    </html>
    I think this should work.
    PS: You can see where I have put in the exrta code, you can remove the added by Mhtml ifyou want, I just put it there so that you can see where I did stuff.
    Last edited by Mhtml; 07-26-2002 at 06:27 AM.
    Omnis mico antequam dominus Spookster!

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Mhtml,

    thank you so much, i will test it immediately. If oracleguy you get a chance to read this post could you doublecheck Mhtml's work?


    thank you,

    DHTMLHELP

  • #12
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    It should work for ya. I didn't see anything wrong with it.
    OracleGuy

  • #13
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Not Working

    Hi,

    it doesn't seem to work, I get the following message:

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'strAutoBody'

    /asp/test.asp, line 50


    DHTMLHELP

  • #14
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    oh ok, I see the prob. I didn't declare the variable strAutoBody.

    I have fixed it.
    Code:
    <% 
    'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser 
    Response.Buffer = True 
    
    'Dimension variables 
    Dim strBody 'Holds the body of the e-mail 
    Dim objCDOMail 'Holds the mail server object 
    Dim strMyEmailAddress 'Holds your e-mail address 
    Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail 
    Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail 
    Dim strReturnEmailAddress 'Holds the return e-mail address of the user 
    Dim strAutoEmailAddress 'Holds e-mail address of the user for Auto Responder
    Dim strAutoBody 'Body for Auto Response
    '----------------- Place your e-mail address in the following sting ---------------------------------- 
    
    strMyEmailAddress = "sales@domain.com" 
    
    '----------- Place Carbon Copy e-mail address's in the following sting, separated by ; -------------- 
    
    strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail 
    
    '----------- Place Blind Copy e-mail address's in the following sting, separated by ; -------------- 
    
    strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail 
    
    '----------------------------------------------------------------------------------------------------- 
    
    
    'Read in the users e-mail address 
    strReturnEmailAddress = Request.Form("email") 
    
    
    'Initialse strBody string with the body of the e-mail 
    strBody = "<h2>Test Header</h2>" 
    strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress 
    
    
    'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected 
    If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then 
    
    'Set the return e-mail address to your own 
    strReturnEmailAddress = strMyEmailAddress 
    End If 
    
    '---------------------------------Auto Response Information Added by Mhtml-------------------------
    'Set the users e-mail address
    strAutoEmailAddress = strReturnEmailAddress
    
    'set auto response body
    strAutoBody = "Thank you for you order.<br><font color=(ff0000)>This is an automated response please do not reply to this e-mail</font>"
    '----------------------------------------------END AUTO RESPONSE---------------------------------
    
    'Create the e-mail server object 
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail") 
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent) 
    objCDOMail.From = "<" & strReturnEmailAddress & ">" 
    
    'Who the e-mail is sent to 
    objCDOMail.To = strMyEmailAddress 
    
    'Who the carbon copies are sent to 
    objCDOMail.Cc = strCCEmailAddress 
    
    'Who the blind copies are sent to 
    objCDOMail.Bcc = strBCCEmailAddress 
    
    'Set the e-mail body format (0=HTML 1=Text) 
    objCDOMail.BodyFormat = 0 
    
    'Set the subject of the e-mail 
    objCDOMail.Subject = "Test Title" 
    
    'Set the main body of the e-mail 
    objCDOMail.Body = strBody 
    
    'Importance of the e-mail (0=Low, 1=Normal, 2=High) 
    objCDOMail.Importance = 1 
    
    'Send the e-mail 
    objCDOMail.Send 
    
    'Close the server object 
    Set objCDOMail = Nothing 
    
    '-------------------------------------------------------AUTO RESPONDER ADDED BY Mhtml------------
    
    'Create the e-mail server object 
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail") 
    
    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent) 
    objCDOMail.From = "<" & strMyEmailAddress & ">" 
    
    'Who the e-mail is sent to 
    objCDOMail.To = strAutoEmailAddress 
    
    
    'Set the e-mail body format (0=HTML 1=Text) 
    objCDOMail.BodyFormat = 0 
    
    'Set the subject of the e-mail 
    objCDOMail.Subject = "Auto Response to order submission" 
    
    'Set the main body of the e-mail 
    objCDOMail.Body = strAutoBody 
    
    'Importance of the e-mail (0=Low, 1=Normal, 2=High) 
    objCDOMail.Importance = 1 
    
    'Send the e-mail 
    objCDOMail.Send 
    
    'Close the server object 
    Set objCDOMail = Nothing 
    
    
    
    %> 
    <html> 
    <head> 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
    <title>Test</title> 
    
    </head> 
    
    
    <body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099" alink="#FF0000"> 
    <br> 
    
    </body> 
    
    
    </html>
    Omnis mico antequam dominus Spookster!

  • #15
    Regular Coder
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fantastic

    It's working great now, thanks MHTML.

    One last thing, how can I personalise the Autoresponse. For example if joe@domain.com submits his email how can I get the automated reply to read:

    Hi Joe,

    etc.

    DHTMLHELP


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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