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 to multiple addresses with JMail in ASP

    Hello!
    How would you edit the following code to enable the user to enter multiple email recipients, separated by commas into a single html text field? This "email this article to a friend" form currently only allows the user to email one person. I'm using JMail in ASP.

    Code:
    <% If (Request.Form("requiredemail") = "") Then %>
    <FORM METHOD="POST">
    <p>Email address to send game link to<br>
    <input type="text" name="requiredemail" size="40" maxlength="128"></input>
    <p>Message<br>
    <textarea name="message" cols="35" rows="4">test</textarea>		
    <input type="submit" class="hdindex" value="send"></input>
    </form>
    
    <%Else
    	requiredemailto = Request.Form("requiredemail")
    	message = Request.Form("message")
    						
    strBody = "Link to survey" & chr(10) & chr(10) & _
    
    "Email Address:	      " & requiredemail & chr(10) & _
    "Message:		" & message & chr(10)
    %>
    
    <% 
            set JMail = Server.CreateObject("JMail.SMTPMail")
    	JMail.ServerAddress = "REMOVED FOR POSTING"
    	JMail.Sender = "webmaster@test.org"
    	JMail.SenderName = "test.org"
    	'Who the e-mail is sent to
    	JMail.AddRecipient Request.Form("requiredEmail")
    	JMail.Subject = "Link to article"
    	JMail.Body = Request.Form("message")
    	JMail.Execute
    %>

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Quote Originally Posted by anessa05
    enter multiple email recipients, separated by commas into a single html text field
    I don't want to give too much away, but I'd strongly recommend that you look into the VBScript split() function, possibly the trim() function and, following that, into looping through arrays.



  •  

    Posting Permissions

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