techjunkie.tv

powershell tips, ccna tips, tech videos, learn tech

Archive for the ‘Server 2003’ Category

How to Send a file by email using Gmail and Powershell —

How do you send a file using Powershell 2.0 and a gmail account? Answer: $filename = “c:\scripts_scott\test9999.xls” $smtpserver = “smtp.gmail.com” $msg = new-object Net.Mail.MailMessage $att = new-object Net.Mail.Attachment($filename) $smtp = new-object Net.Mail.SmtpClient($smtpServer ) $smtp.EnableSsl = $True $smtp.Credentials = New-Object System.Net.NetworkCredential(“username”, “password_here”); # Put username without the @GMAIL.com or – @gmail.com $msg.From = “username@gmail.com” $msg.To.Add(”boss@job.com”) $msg.Subject [...]