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.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    53
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Email article script edit to email more than one

    I need to edit my current "Email this article" ASP form that uses JMail. It currently allows the user to email one friend an article. I want the user to be able to email the article to more than one friend. Also; I'd like to limit the total number of recipients to five. Any assistance would be greatly appreciated. Below is my current code for the form and action pages.

    Code:
    ------- email_article.asp -------
    <FORM action="email_article_confirm.asp" method="post" name="Emailthispage">
    
        <%
        DIM strURL
        strURL = Request.ServerVariables("HTTP_Referer")
    
        IF strURL = "" THEN
        Response.Write "Sorry, your browser does not support this function."
        END IF
        %>
    
        <p><b>Page Link:</b> <%= strURL %></p>
    
        <TABLE border="0">
        <TR><TD>Your email:<br><input type="text" name="YourEmail" size="40"></TD></TR>
        <TR><TD>Your first name:<br><input type="text" name="YourName" size="40"></TD></TR>
        <TR><TD>Recipient's email:<br><input type="text" name="RecipEmail" size="40"></TD></TR>
        <TR><TD>Recipient's first name:<br><input type="text" name="RecipName" size="40"></TD></TR>
        <TR><TD>Comments:<br><TEXTAREA name="Comments" cols="50"></TEXTAREA></TD></TR>
        </TABLE>
    
        <input type="hidden" name="URL" value="<%= strURL %>">
        <input type="submit" value="Submit">
        </FORM>
    
    
    ------- email_article_confirm.asp -------
    <%
        DIM objJMail
        strYourEmail = Request.Form("YourEmail")
        strYourName = Request.Form("YourName")
        strRecipEmail = Request.Form("RecipEmail")
        strRecipName = Request.Form("RecipName")
        strComments = Request.Form("Comments")
        strURL = Request.Form("URL")
    
        Set objJMail = Server.CreateObject("JMail.SMTPMail")
        objJMail.ServerAddress = "REMOVED FOR FORUM POST"
    	objJMail.Sender = Request.Form("YourEmail")
        objJMail.SenderName = Request.Form("YourName")
        objJMail.AddRecipient Request.Form("RecipEmail")
        objJMail.Subject = "Look at this page from the www.TEST.org website"
        objJMail.Body = strRecipName & "," & vbCrLf & vbCrLf & strYourName & " wants you to take a look at this page at www.TEST.org:" & vbCrLf & "Page Link: " & strURL & vbCrLf & vbCrLf & strComments
        IF objJMail.Execute THEN
        
    Set objJMail = Nothing
    
    	%>
        <p>
    	<%
        strYourName = request.form("YourName")
        Response.Write strYourName
        %>,</p>
        <p>Thank you for sharing this page with
        <%
        strRecipName = request.form("RecipName")
        Response.Write strRecipName
        %>
        . Your message has been sent successfully and will be received by
        <%
        strRecipName = request.form("RecipName")
        Response.Write strRecipName
        %>
        shortly.</p>
    
        <%
        ELSE
        Response.Write "Sorry, there was an error and your email could not be sent at this time."
        END IF
        %>

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In your HTML have 5 textfields.

    In your script validate them to check that they are filled in and are valid email format.

    You can then loop the email for each or join together the names to send as a BCC etc.


  •  

    Posting Permissions

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