如何将文件发送到指定的邮箱 [英] How can I send a file to a specified mailbox
本文介绍了如何将文件发送到指定的邮箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.如何将文本文件发送到指定的邮箱?发送电子邮件可以.请显示您的代码.非常感谢!
Hello everyone. How can I send a text file to a specified mailbox? Sending email is OK. Show your CODE, please. Many thanks!
推荐答案
Dim client As SmtpClient
client = New SmtpClient("smtp")
client.Credentials = New Net.NetworkCredential("username","pass")
client.EnableSsl = True
'client = New SmtpClient(smtpserver)
Dim mail As New MailMessage()
mail.From = New MailAddress("youremailaddress")
mail.To.Add("tosomeone@123.com")
mail.Subject = "test"
mail.Body = This is automated email. Please do not reply.
Dim attachment As New Net.Mail.Attachment("c:\123.xls")
mail.Attachments.Add(attachment)
client.Send(mail)
client = Nothing
这篇关于如何将文件发送到指定的邮箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文