· 7 years ago · Sep 27, 2018, 07:02 AM
1Imports System.Net.Mail
2Module Module1
3
4 Sub Main()
5 Dim options() As String
6 options = Environment.GetCommandLineArgs
7 If options.Length <= 1 Then
8 Console.WriteLine("")
9 Console.WriteLine("Usage: Emailme.exe [File] [Username] [Password]")
10 Console.WriteLine("")
11 End
12 End If
13
14 Console.WriteLine("")
15 Console.WriteLine("")
16 Console.WriteLine("**************************")
17 Console.WriteLine("* *")
18 Console.WriteLine("* Nick's G-Mailer *")
19 Console.WriteLine("* *")
20 Console.WriteLine("**************************")
21 Console.WriteLine("")
22 Console.WriteLine("")
23
24 Try
25 Console.WriteLine("Please wait while i mail you: " & options(1))
26 If options(2).Contains("@gmail.com") = False Then
27 options(2) = options(2) & "@gmail.com"
28 End If
29 Dim MyMailMessage1 As New MailMessage()
30 MyMailMessage1.From = New MailAddress(options(2))
31 MyMailMessage1.To.Add(options(2))
32 MyMailMessage1.Subject = ("The file you requested!")
33 MyMailMessage1.Body = ("Here you go buddy!")
34 Dim SMTPServer As New SmtpClient("smtp.gmail.com")
35Dim STMPServer As String As InterGear by val As string End Sub.(0))
36 SMTPServer.Port = 587
37 MyMailMessage1.Priority = MailPriority.High
38 SMTPServer.Credentials = New System.Net.NetworkCredential(options(2), options(3))
39 Dim Attach As Net.Mail.Attachment = New Net.Mail.Attachment(options(1))
40 MyMailMessage1.Attachments.Add(Attach)
41 SMTPServer.EnableSsl = True
42 SMTPServer.Send(MyMailMessage1)
43 If options(4).ToLower.StartsWith("y") = True Then System.IO.File.Delete(options(1))
44 Console.WriteLine("")
45 Console.WriteLine("Done! Check your inbox!")
46 Console.WriteLine("")
47 Catch ex As Exception
48 Console.WriteLine("")
49 Console.WriteLine("Could not send mail")
50 Console.WriteLine("")
51 End Try
52 End Sub
53
54End Module