Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. @echo off
  2. for /f %%i in ('where /r c:\ a.txt') do set VAR=%%i
  3. echo %VAR%
  4. PAUSE
  5.  
  6. powershell.exe -command "&{$SMTPServer = 'smtp.gmail.com'; $SMTPPort = '587'; $Username = 'nadavtome@gmail.com'; $Password = 'nhftktcrvo'; $to = 'nadavtome@gmail.com'; $subject = 'Email Subject'; $body = 'Insert body text here'; $attachment = $args[0]; $message = New-Object System.Net.Mail.MailMessage; $message.subject = $subject; $message.body = $body; $message.to.add($to); $message.from = $username; $message.attachments.add($attachment); $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort); $smtp.EnableSSL = $true; $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password); $smtp.send($message);} %VAR%"
  7. ::works powershell.exe -command "&{$SMTPServer = 'smtp.gmail.com'; $SMTPPort = '587'; $Username = 'nadavtome@gmail.com'; $Password = 'nhftktcrvo'; $to = 'nadavtome@gmail.com'; $subject = 'Email Subject'; $body = 'Insert body text here'; $attachment = 'C:\Users\Isaac\Desktop\myfile1234.txt'; $message = New-Object System.Net.Mail.MailMessage; $message.subject = $subject; $message.body = $body; $message.to.add($to); $message.from = $username; $message.attachments.add($attachment); $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort); $smtp.EnableSSL = $true; $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password); $smtp.send($message);}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement