本文介绍了发送电子邮件从word文件中取出的信件的正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
美好的一天。我需要发一封信给电子邮件。但这封信的正文取自Word文件(.doc或.docx)
我知道如何执行简单的信件发送。
我尝试过:
Good day. I need to send a letter to the e-mail. But the body of the letter is taken from a Word file (.doc or .docx)
I know how to perform a simple letter sending.
What I have tried:
Imports System.Net.Mail
Imports System.Text
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim email As New MailMessage
Dim smtp As SmtpClient
smtp = New SmtpClient("smtp.yandex.ru")
smtp.Port = 587
smtp.Credentials = New Net.NetworkCredential("[email protected]", "")
email.From = New MailAddress("[email protected]")
email.To.Add(New MailAddress("[email protected]"))
email.Body = "Post" ' body of the letter take the text (data from MS Word (doc or docx)
email.Subject = "Post"
email.Attachments.Add(New System.Net.Mail.Attachment("D:\files.txt"))
smtp.Send(email)
End Sub<pre>
推荐答案
这篇关于发送电子邮件从word文件中取出的信件的正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!