Im trying to make a little program that gets the computers IP address i have got it to do all of that and have got it to use the default email program to add the email address, subject and body but i cannot get it to add an attachment.
Imports System.Net.Mail
Public Class FrmRemote
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
SaveFile.InitialDirectory = "C:\"
SaveFile.FileName = "Remote Help"
SaveFile.Filter = "Rich Text Format (*.rtf) | *.rtf"
SaveFile.ShowDialog()
Dim W As New IO.StreamWriter(SaveFile.FileName)
W.WriteLine(txtName.Text)
W.WriteLine(txtPhone.Text)
W.WriteLine(txtAddress.Text)
W.WriteLine(txtProblem.Text)
W.WriteLine(txtIP.Text)
W.Close()
End Sub
Private Sub btnCollect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCollect.Click
Dim WC As New System.Net.WebClient
txtIP.Text =
System.Text.Encoding.ASCII.GetString((WC.DownloadData("http://whatismyip.com/automation/n09230945.asp")))
WC.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim strSubject As String 'subject title
Dim strBody As String 'Body of message
Dim strSubject1 As String 'Subject line
Dim strBody2 As String 'Body of Message
strSubject = "Need Remote Pc Help" 'store subject in variable
strBody = "Here is all the info that you need for the help txtName" 'store body in variable
Dim mail As New System.Text.StringBuilder
strSubject1 = "?subject=" & strSubject
strBody2 = "&body=" & strBody
mail.Append("mailto:backstback@hotmail.com") 'email address
mail.Append(strSubject1) 'subject
mail.Append(strBody2) 'body of message
SendMail(mail.ToString)
End Sub
Private Function SendMail(ByVal MailtoStr As String) As Boolean
Dim MailP As New Process 'declare a new process
MailP.StartInfo.FileName = MailtoStr 'open default mail client
MailP.StartInfo.UseShellExecute = True
MailP.StartInfo.RedirectStandardOutput = False
MailP.Start()
MailP.Dispose()
End Function
End Class
So what im asking is does anyone know how to add get this code to add an attachment?
Thanks,
Ryan