ASP 101 - Active Server Pages 101 - Web06
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash




FAQ for the Tell a Friend sample:


How can I let users send the message to multiple friends by separating their email addresses with a comma?

Actually, classic ASP allows this by default. The only reason it doesn't work with the Tell a Friend sample is because of the additional checking we do to make sure the email is valid and to prevent abuse of the system. If you want to allow users to do this, you simply need to revise the validation to allow it.

In the case of this sample, I'd probably just replace this line:

bValidInput = bValidInput And IsValidEmail(strToEmail)

with the following:

Dim arrToEmail, I
strToEmail = Replace(strToEmail, ", ", ",")
arrToEmail = Split(strToEmail, ",")
For I = LBound(arrToEmail) To UBound(arrToEmail)
    bValidInput = bValidInput And IsValidEmail(arrToEmail(I))
Next

The first line removes spaces that follow commas. The second splits the list of email addresses into an array of email addresses. The loop then runs through the array making sure each message passes validation. If any of them fail, the script will display an error message. Otherwise the message should be sent to the whole list of users.

This fix is nice because it follows the same pattern as the rest of the script and is quite easy to implement. It also allows us to use the same validation routine as we do for single email addresses which keeps things nice and simple.

Was your question not answered above?

Ask a new question

Please note: This form is only for submitting questions about the sample for us to consider including in the FAQ. If we feel the question merits inclusion, we will include it along with a reply. We will not respond to your email individually.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers