PDA

View Full Version : Sending Email problem


Sintsof
11-29-2002, 04:27 PM
Hello,
This is my first message...
I have a problem with mail sending! The visitors can send a message with my message service. And if they want, i can notify recipient for this message. So, i need when i approve these messages automaically send email recipients which message wants me to notify it's recipient. But There was a problem. The first recipient received first message, but the second recipient received first and second message...
I didn't find problem.
Here is my code:

Set Mail = Server.CreateObject("Persits.MailSender")
Set RS=conn.Execute("Select * From Mesaj Where ID IN ("&Request.Form("Onayla")&")")
While Not RS.EOF
If RS("EmailBildir")=True Then
Mail.Host = "mail.host.com"
Mail.From = "mail@host.com"
Mail.IsHTML = True
Mail.AddAddress RS("AMail")
Mail.Subject = "Mesaj"
mesajmetni = RS("GAd") + " Size Bir Mesaj Gönderdi"
Mail.Body = mesajmetni
Mail.Send
Mail.Reset()
'RS("EmailBildir")=False
'RS.Update
End If
RS.MoveNext
Wend
RS.Close
Set RS=Nothing


Thanks now...

Morgoth
12-01-2002, 01:12 AM
Well, first off, I don't use Persist, but they are a good company.

I think it's when you added the new e-mail address:
Mail.AddAddress RS("AMail")
You added 1 e-mail, then you added the other e-mail without clearing the list.
You need to clear the list then do it again, maybe...

Look for a list clearing function that persist must have. Read the instrustions and look for a place to tell you correct syntax.

Sintsof
12-02-2002, 11:19 AM
Thank you Morgoth,
I found the problem.

I should have cleared my mail body string. So I added this in my code:

...
Mail.Body = mesajmetni
Mail.Send
Mail.Reset()
mesajmetni=""
End If
RS.MoveNext


:)

Morgoth
12-02-2002, 07:24 PM
It was a full guess, but I have used list boxes in Visual Basic before, and if you add to it, it doesn't clear it.
And I rememberd I had to clear it before cause I have the same problem.

So it was a guess, but and educated guess.

whammy
12-03-2002, 12:40 AM
Good call... I did the same thing with a CDONTS email awhile back...