-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgmailmodule.vb
More file actions
43 lines (40 loc) · 1.7 KB
/
gmailmodule.vb
File metadata and controls
43 lines (40 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Imports System.Net.Mail
Module Module1
Sub Main()
Dim options() As String
options = Environment.GetCommandLineArgs
If options.Length <= 1 Then
Console.WriteLine("")
Console.WriteLine("Usage: Emailme.exe [File] [Username] [Password]")
Console.WriteLine("")
End
End If
Try
Console.WriteLine("Please wait while i mail you: " & options(1))
If options(2).Contains("@gmail.com") = False Then
options(2) = options(2) & "@gmail.com"
End If
Dim MyMailMessage1 As New MailMessage()
MyMailMessage1.From = New MailAddress(options(2))
MyMailMessage1.To.Add(options(2))
MyMailMessage1.Subject = ("The file you requested!")
MyMailMessage1.Body = ("Here you go buddy!")
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
MyMailMessage1.Priority = MailPriority.High
SMTPServer.Credentials = New System.Net.NetworkCredential(options(2), options(3))
Dim Attach As Net.Mail.Attachment = New Net.Mail.Attachment(options(1))
MyMailMessage1.Attachments.Add(Attach)
SMTPServer.EnableSsl = True
SMTPServer.Send(MyMailMessage1)
If options(4).ToLower.StartsWith("y") = True Then System.IO.File.Delete(options(1))
Console.WriteLine("")
Console.WriteLine("Done! Check your inbox!")
Console.WriteLine("")
Catch ex As Exception
Console.WriteLine("")
Console.WriteLine("Could not send mail")
Console.WriteLine("")
End Try
End Sub
End Module