Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 4th, 2006, 11:11 PM
Authorized User
 
Join Date: Nov 2005
Location: , , United Kingdom.
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 "peter@1234.com, peter@5678.com, peter@abcd.com" it will only send to peter@1234.com.

Thanks
Pete*
__________________
Simplicity is the key
Reply With Quote
  #2 (permalink)  
Old March 5th, 2006, 09:10 AM
Wrox Technical Editor
 
Join Date: Nov 2005
Location: , , Canada.
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

- A.Kahtava
Reply With Quote
  #3 (permalink)  
Old March 5th, 2006, 07:25 PM
Authorized User
 
Join Date: Nov 2005
Location: , , United Kingdom.
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*

Reply With Quote
  #4 (permalink)  
Old March 5th, 2006, 08:53 PM
Wrox Technical Editor
 
Join Date: Nov 2005
Location: , , Canada.
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

- A.Kahtava
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12:34 PM
Email Bcc problem mohana VB How-To 0 December 5th, 2006 08:17 AM
Validate multiple email addresses... mat41 Javascript 5 March 15th, 2006 11:17 PM
SQL query for email addresses clearsky SQL Language 1 October 7th, 2005 10:15 PM



All times are GMT -4. The time now is 10:43 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.