Advertisement
Wail3Y

check

Sep 9th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Username = [IO.File]::ReadAllText(".\username.txt");
  2. $Password = [IO.File]::ReadAllText(".\pass.txt");
  3. $erroractionpreference = "SilentlyContinue"
  4. function Send-ToEmail([string]$email, [string]$attachmentpath){
  5.  
  6.     $message = new-object Net.Mail.MailMessage;
  7.     $message.From = $Username;
  8.     $message.To.Add($email);
  9.     $message.Subject = "This is a confirmation email.";
  10.     $message.Body = "This is a confirmation email.";
  11.  
  12.  
  13.     $smtp = new-object Net.Mail.SmtpClient("smtp.gmail.com", "587");
  14.     $smtp.EnableSSL = $true;
  15.     $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
  16.     $smtp.send($message)
  17.    
  18.  }
  19.  Send-ToEmail  -email "test111test111test111@test111.com";
  20.  if (-not ([string]::IsNullOrEmpty($Error)))
  21. {
  22.     Set-Content -Value "1" -Path .\error.txt
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement