p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   Multiple Bcc email addresses (http://p2p.wrox.com/showthread.php?t=39363)

peterasimpson March 5th, 2006 12:11 AM

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*

adam_kahtava March 5th, 2006 10:10 AM

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

- A.Kahtava

peterasimpson March 5th, 2006 08:25 PM

:)
 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*


adam_kahtava March 5th, 2006 09:53 PM

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

- A.Kahtava


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

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