Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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("admin@yandex.ru", "")
        email.From = New MailAddress("admin@yandex.ru")
        email.To.Add(New MailAddress("SEVlasova@yandex.ru"))
        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>
Posted
Updated 25-Feb-19 21:25pm
Comments
OriginalGriff 26-Feb-19 2:09am    
And?
Where are you stuck?
What have you tried?
What help do you need?
Lander13 26-Feb-19 2:22am    
I do not know how to take data from MS Word (docx). and insert into the body of the letter when sending
OriginalGriff 26-Feb-19 3:17am    
Which bits do you know how to do?
What resources do you have available?
What environment is this to run under?
What have you tried? (Other than "asking here")

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900