0

I want send mail with Bcc (Blind carbon copy) with vb.net, but I do not know how to do it.

this is my code:

Function send_MAIL() As Boolean

    Dim smtpServer As New SmtpClient()
    Dim mail As New MailMessage()
    'credenziali per accedere
    smtpServer.Credentials = New Net.NetworkCredential("lllll@live.it", "******")
    'porta del tuo HOST di posta 
    smtpServer.Port = 587
    'SMTP del  HOST di posta 
    smtpServer.Host = "smtp.live.com"
    'SSL
    smtpServer.EnableSsl = True
    'Creiamo la mail da spedire
    mail = New MailMessage()
    'Inserisci l'indirizzo di posta che verrà visualizzato dal destinatario
    mail.From = New MailAddress("ddddd@live.it")
    'Inserisci l'email del destinatario
    mail.To.Add("pppppp@hotmail.it")
    mail.To.Add("llllll@live.it")
    'Inserisci l'oggetto
    mail.Subject = "OGGETTO"
    'testo dell'email 
    mail.Body = "email prova"
    smtpServer.Send(mail)
    Return True
End Function
ɐsɹǝʌ ǝɔıʌ
  • 4,440
  • 3
  • 35
  • 56
  • see this : http://www.aspnettutorials.com/tutorials/email/email-cc-aspnet2-vb/ – CristiC777 Sep 22 '15 at 09:07
  • and if I wanted to soak in a file – luca bigoni Sep 22 '15 at 09:12
  • It seems like you can do mail.bcc.Add("email@domain.com") https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.bcc(v=vs.110).aspx – phil652 Sep 22 '15 at 13:20
  • I don't understand the question about "wanted to soak in a file". I'm assuming that's either a typo or the wrong word in English. Could you clarify? Or if it is not related to "how do I add bcc" then you should ask a new question. – hometoast Sep 22 '15 at 13:27

2 Answers2

1

You would simply use the Bcc member.

mail.Bcc.Add("mailtobcc@domain.com")
hometoast
  • 11,522
  • 5
  • 41
  • 58
0

I use this:

Dim c As Net.Mail.MailAddress = New Net.Mail.MailAddress(dirección)
myMsg.Bcc.Add(c)

Where "dirección" is a valid email address

Hope this can help you. Bye!

AMCampos
  • 66
  • 4