Forums

This topic is locked

Problem with Recordsets and Jmail

Posted 30 Jun 2003 15:42:08
1
has voted
30 Jun 2003 15:42:08 Jeff Montgomery posted:
I am trying to build a page that send mail. It works up to the point that I try to add multiple reciepients.

The way I was trying to do it was on my page that I fill out forms for the email messege I have a text box with the following:

<textarea name="emailTo" cols="35" rows="2">
<%
While ((Repeat1__numRows <> 0) AND (NOT rsEmail.EOF))
%>
<%=(rsEmail.Fields.Item("contactEmail".Value)%>;
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsEmail.MoveNext()
Wend
%>
</textarea>

This seems to work I have all of the email addresses in there with a ; seperating them. But when I go to send I get the following:

Error Type:
jmail.SMTPMail (0x8000FFFF)
The message was undeliverable. All servers failed to receive the message
/email/sendmail.asp, line 24

My code for the sendmail.asp is:
<%

SenderEmail = Request.Form("emailFrom"
Subject = Request.Form("emailSub"
Recipient = Request.Form("emailTo"
Body = Request.Form("text"
Set JMail = Server.CreateObject("JMail.SMTPMail"

JMail.ServerAddress = "mail.mailserver.com
JMail.Sender = Senderemail
JMail.Subject = Subject

JMail.AddRecipient Recipient



JMail.Body = Body

JMail.Priority = 3

JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR"
JMail.Logging = True
JMail.Execute

%>
Your message has been sent.


Please help me find out what is going on or please give me any suggestions I might try.

Edited by - jrmontgomery on 01 Jul 2003 19:31:39

Replies

Replied 01 Jul 2003 16:41:58
01 Jul 2003 16:41:58 Stefan P replied:
I see what you're trying to achieve and you're on the right track.

What you need to do is loop throught the records getting the email addresses, but instead if attempting to mail them in one go, you also need to loop the Jmail code so that it fires off individual emails for each recipient.

DMX | ASP | VBScript | ACCESS | IIS5
Replied 01 Jul 2003 19:33:47
01 Jul 2003 19:33:47 Jeff Montgomery replied:
That makes sense. I saw that on the Jmail web site
JMail.AddRecipient
JMail.AddRecipient

I am just not sure to how to write the script for it.

Reply to this topic