Hello,
I am trying to figure out how to send an e-mail from my program with the contents of a richtextbox. For example: I am creating a notepad style program. And say I want to send what I wrote in the textbox via e-mail the short and quick way via the program. I want to be able to have the body of the email be the text that is written in the textbox on the main page. Here is the code. Any help would be greatly appreciated. Thanks.
CODE
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
Dim address As New System.Net.Mail.MailMessage(YourEmail.Text, SendTo.Text)
address.Subject = Subject.Text
address.Body = Notepad2.TextBox
'If your email body contains Html tags then
address.IsBodyHtml = False
'Dim smtp As New System.Net.Mail.SmtpClient("ServerName", 25)
'For eg for gmail you can give --
Dim smtp As New System.Net.Mail.SmtpClient("smtp.gmail.com", 465)
smtp.Send(address)
End Sub
YourEmail.Text = Text box that the user inputs their email address
SendTo.Text = Text box that the user inputs the designation email
Subject.Text = Text box that the user includes a subject line for the email
Notepad2.TextBox = The contents in which the user write something in to be inputted as a body content (this is the part that i get confused and lost at. It is asking me that it cannot be converted into a 'string')
Thanks.
The Rock