Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- for /f %%i in ('where /r c:\ a.txt') do set VAR=%%i
- echo %VAR%
- PAUSE
- 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%"
- ::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