Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Username = [IO.File]::ReadAllText(".\username.txt");
- $Password = [IO.File]::ReadAllText(".\pass.txt");
- $erroractionpreference = "SilentlyContinue"
- function Send-ToEmail([string]$email, [string]$attachmentpath){
- $message = new-object Net.Mail.MailMessage;
- $message.From = $Username;
- $message.To.Add($email);
- $message.Subject = "This is a confirmation email.";
- $message.Body = "This is a confirmation email.";
- $smtp = new-object Net.Mail.SmtpClient("smtp.gmail.com", "587");
- $smtp.EnableSSL = $true;
- $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
- $smtp.send($message)
- }
- Send-ToEmail -email "test111test111test111@test111.com";
- if (-not ([string]::IsNullOrEmpty($Error)))
- {
- Set-Content -Value "1" -Path .\error.txt
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement