|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 = "email@example.com,firstname.lastname@example.org,email@example.com"
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 = "firstname.lastname@example.org"
Mail.Subject = "Hello!"
Addresses = "email@example.com,firstname.lastname@example.org,email@example.com"
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 - 2019
For technical support, write to firstname.lastname@example.org.