1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

From mailing

Discussion in 'C#' started by SkeeTeR_Mcgee, Jun 30, 2006.

  1. #1
    Hi guys

    I was wondering if anyone can help me out with form mailing. I have made it as far as getting the forms to go in email from from my website but I am stuck like a pig when it comes to making it send with a file attachment. Here is my code, any feedback is much appreciated.

    <table border="0">
    <tr>
    <td>
    <form action="gdform.asp" method="post" ENCTYPE="multipart/form-data" name="Contact">
    <input type="hidden" name="subject" value="New Message" />
    <input type="hidden" name="redirect" value="thankyou.html" />
    </td>
    </tr>
    <tr>
    <td>Name:</td><td><input type="text" name="Name" /></td>
    </tr>
    <tr>
    <td>Phone:</td><td><input type="text" name="Phone" /></td>
    </tr>
    <tr>
    <td>E-Mail:</td><td><input type="text" name="email" /></td>
    </tr>
    <tr>
    <td>Comments:</td><td><textarea name="comments" cols="45" rows="15">
    Type comments here.</textarea></td>
    </tr>
    <tr>
    <td>Attachment:</td><td><input type="file" name"Ad" size="60"></td>
    </tr>
    <tr><td></td>
    <td><div align="center"><input type="submit" name="submit" value="submit"/></div></td><td></td>
    </form>
    </tr>
    </table>
    SEMrush
    PS
    this is on godaddy and i am using the defualt formmailer becuase i am not sure how to upload aspcode to my server.



    **edit**
    if i remove the ENCTYPE="multipart/form-data" from the from string it lets the form fields through but the result is only text in the email. when i keep it in it has a dastardly error "No variables sent to form! Unable to process request."

    Thanks
     
    SkeeTeR_Mcgee, Jun 30, 2006 IP
    SEMrush
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    ludwig, Jun 30, 2006 IP
  3. SkeeTeR_Mcgee

    SkeeTeR_Mcgee Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <%
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject="Sending email with CDO"
    myMail.From="mymail@mydomain.com"
    myMail.To="someone@somedomain.com"
    myMail.TextBody="This is a message."
    myMail.AddAttachment "c:\mydocuments\test.txt"
    myMail.Send
    set myMail=nothing
    %>

    sorry, im not sure how this plugs into my existing code or for that matter if it is even supposed to.

    can you please give a more in depth explaination, i'm new to this

    thank you
     
    SkeeTeR_Mcgee, Jun 30, 2006 IP
  4. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #4
    this should be your "gdform.asp" file

    1. myMail.Subject=trim(request("subject"))
    2. myMail.From=trim(request("Name")) & "<" & trim(request("email")) &">"
    3. myMail.TextBody=trim(request("comments"))

    at the end you'll need to redirect the user to the page where your form is or put a JavaScript like this
    ASP
    <%response.redirect "contact.asp?message=Your mail was sent."%>
    Code (markup):
    JavaScript
    <html>
    <head>
    <title>Email sent!</title>
    <script language="JavaScript">
    <!--hide from old browsers
    var time = null
    function move() {
    window.location = 'http://www.gta.am/'
    }
    //-->
    </script>
    </head>
    <%YOUR ASP CODE HERE%>
    
    <body onload="timer=setTimeout('move()',5000)">
    <div class="title" align="center">Thank you for contacting us!  You will be redirected to the contacts page in 5 seconds.</div>
    </body>
    </html>
    
    Code (markup):
    You might need to upload the file to the server before sending
     
    ludwig, Jun 30, 2006 IP
  5. SkeeTeR_Mcgee

    SkeeTeR_Mcgee Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ok, 2 things i have questions about.

    1. all i need is for the form to be emailed directly to me at my email address.

    2. I don't want the file to be required material for the form to send.


    does this code enable both of these things?
     
    SkeeTeR_Mcgee, Jun 30, 2006 IP
  6. dirsubmit

    dirsubmit Banned

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Try editin this line

    <td>Attachment:</td><td><input type="file" name[COLOR="Red"]=[/COLOR]"Ad" size="60"></td>
    Code (markup):
     
    dirsubmit, Jun 30, 2006 IP
  7. SkeeTeR_Mcgee

    SkeeTeR_Mcgee Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    edit it how?
     
    SkeeTeR_Mcgee, Jun 30, 2006 IP
  8. dirsubmit

    dirsubmit Banned

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    place = between name and "ad"
     
    dirsubmit, Jun 30, 2006 IP