2015-09-22 180 views
0

我想用vb.net發送郵件用Bcc(密件抄送),但我不知道該怎麼做。用密件抄送郵件

這是我的代碼:

Function send_MAIL() As Boolean 

    Dim smtpServer As New SmtpClient() 
    Dim mail As New MailMessage() 
    'credenziali per accedere 
    smtpServer.Credentials = New Net.NetworkCredential("[email protected]", "******") 
    '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("[email protected]") 
    'Inserisci l'email del destinatario 
    mail.To.Add("[email protected]") 
    mail.To.Add("[email protected]") 
    'Inserisci l'oggetto 
    mail.Subject = "OGGETTO" 
    'testo dell'email 
    mail.Body = "email prova" 
    smtpServer.Send(mail) 
    Return True 
End Function 
+0

看到這個:http://www.aspnettutorials.com/tutorials/email/email-cc-aspnet2-vb/ – CristiC777

+0

,如果我想浸泡在一個文件 –

+0

看來你可以做mail.bcc.Add (「[email protected]」)https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.bcc(v=vs.110).aspx – phil652

回答

0

我用這個:

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

其中 「dirección」 是一個有效的電子郵件地址

希望這可以幫助你。再見!