hello, i would to attach file to my mail, and the file path to my mail is on a textbox. I would like to know how i can tell it, that the filepath to be attached is the text on the textbox. i tried with textb.text, but it saysit's not a valid... .attachment
asp Code:
Imports System.Net
Imports System.Net.Mail
Dim msg As New MailMessage(EmailFromTextBox.Text, EmailToTextBox.Text, EmailSubjectTextBox.Text, EmailBodyTextBox.Text)
msg.IsBodyHtml = True
StatusLabel.Visible = False
Try
Dim client As New SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.UseDefaultCredentials = false
client.Credentials = loginInfo
client.Send(msg)
Catch ex As SmtpException
StatusLabel.Visible = True
StatusLabel.Style.Add("color", "#CC0033")
StatusLabel.Text = "The following error occurred: " + "<br /><br />" + ex.Message
Return
End Try
StatusLabel.Visible = True
StatusLabel.Style.Add("color", "#009966")
StatusLabel.Text = "Email sent successfully."
thx