简体   繁体   English

VB.net重置SMTP连接

[英]VB.net Reset SMTP Connection

I coded an application that I use to send certain mails with. 我编写了一个用于发送某些邮件的应用程序。 It contains a list of email addresses that can be selected as the receiver. 它包含可以选择作为接收者的电子邮件地址列表。 Everytime I send a mail to one receiver, lets say 1@gmail.com, everythink works out just fine. 每次我向一个接收者发送邮件时,例如1 @ gmail.com,everythink都可以正常工作。 If I send a second email to a new receiver, lets say 2@gmail.com, my email is sent to 1@gmail.com aswell as 2@gmail.com. 如果我向新的收件人发送第二封电子邮件,例如2@gmail.com,则我的电子邮件也会发送到1@gmail.com以及2@gmail.com。 I tried using the Dispose() Function, but that gave me a bunch of errors. 我尝试使用Dispose()函数,但这给了我很多错误。 It must somehow be possible to fix that error I guess. 我猜一定可以解决该错误。 I tried about restarting the SMTP session. 我尝试过重新启动SMTP会话。

Before adding a new email address, you can clear the previous ones 在添加新的电子邮件地址之前,您可以清除以前的电子邮件地址

 email.To.Clear()
 email.To.Add ("2@gmail.com")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM