|HOWTO: Sending messages to multiple recipients with AspEmail |
The methods AddAddress, AddBcc, AddCC and AddReplyTo
of AspEmail 4.5 (and all earlier versions)
do not accept comma-separated lists of email addressed, therefore
the following code snippet is incorrect:
' Incorrect for AspEmail 4.5 and earlier
Addr = "firstname.lastname@example.org,email@example.com,firstname.lastname@example.org"
To send email to multiple recipients, you must not use comma-separated
lists of addresses. Instead, you must call the AddAddress (AddBCC, AddCC, AddReplyTo)
method individually on each email address, as follows:
If your application stores email addresses as comma-separated
lists, you must extract individual addresses from it
and pass them to AspEmail one by one.
The following code snippet
extracts individual email addresses from a comma-separated
and feeds them to AspEmail. The last address in the list
is fed via the method AddAddress, the others via
the method AddCC.
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mail.myisp.com"
Mail.From = "email@example.com"
Mail.Subject = "Hello!"
Addresses = "firstname.lastname@example.org,email@example.com,firstname.lastname@example.org"
NextComma = InStr(Addresses, ",")
If NextComma = 0 Then
Address = Left(Addresses, NextComma - 1)
Addresses = Mid(Addresses, NextComma + 1)
Created: 2/8/2002 4:35:34 AM
Last Modified: 2/9/2002 4:11:42 PM
Copyright © Persits Software, Inc. 1998 - 2018
For technical support, write to email@example.com.