Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2006, 12:11 AM
Authorized User
 
Join Date: Nov 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple Bcc email addresses

I'm having a huge problem with the following . I've written a package which people seem to like. I have had a couple of requests to ad a customers email mailshot. The problem is that every time I write the routine the Bcc only sends the 1st email address in the list and that is it. Here is my code in VB 2005.

Imports System.Net.Mail

        Dim SendFrom As MailAddress = New MailAddress(TxtFrom.Text)
        Dim SendTo As MailAddress = New MailAddress(TxtTo.Text)
        Dim SendBcc As MailAddress = New MailAddress(Emails)

        Dim Message As MailMessage = New MailMessage(SendFrom)

        Message.Bcc.Add(SendBcc)

        Message.Subject = TxtSubject.Text
        Message.Body = TxtBody.Text

        Dim EmailClient As New SmtpClient("smtp.blueyonder.co.uk")
        EmailClient.Send(Message)

Everything works great but the 'SendBcc' will only send to the 1st email in the list. For example if the following was my list "[email protected], [email protected], [email protected]" it will only send to [email protected].

Thanks
Pete*
__________________
Simplicity is the key
 
Old March 5th, 2006, 10:10 AM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To add multiple addresses, call the .Add() method multiple times.

- A.Kahtava
 
Old March 5th, 2006, 08:25 PM
Authorized User
 
Join Date: Nov 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:)
 I'm sorry but I have already figured out the answer to my problem. I didn't have to call the .Add() method multiple times.

All I had to do was change this line

Dim SendBcc As MailAddress = New MailAddress(Emails)

to this

Dim SendBcc As String = (Emails)

I almost died when it worked. :D

Thanks anyway
Pete*

 
Old March 5th, 2006, 09:53 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey; that's good to know, thanks for posting the solution.. :)

- A.Kahtava





Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate multiple email addresses mat41 Javascript 1 August 29th, 2007 12:45 AM
objCDO.bCc with multi emails xxsuperfly Classic ASP Databases 1 December 31st, 2006 01:34 PM
Email Bcc problem mohana VB How-To 0 December 5th, 2006 09:17 AM
Validate multiple email addresses... mat41 Javascript 5 March 16th, 2006 12:17 AM
SQL query for email addresses clearsky SQL Language 1 October 7th, 2005 10:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.