Posts

Sending an email with Powershell

$SmtpServer = “yourServer”
$From = me@N2NetworkSolutions.com
if ($args.Length -lt 1) {
     $To = Engineers@N2NetworkSolutions.com
}
else {
     $to = $args[0]
}
$subject = “Need computer consulting”
$Body = “Hi, this is John Doe I need cheap Exchange consulting at $125/hour”
$smtpClient = new-object system.net.mail.smtpClient
$smtpclient.host = $smtpServer
$smtpclient.send($from, $to, $subject, $body)
 
 
Once this file is saved to ps1 format you can use it via this syntax
TestMessage Sales@N2NetworkSolutions.com

Secure Exchange SMTP communication

http://www.msexchange.org/tutorials/Securing-SMTP-Message-Flow-between-different-Exchange-Server-2007-organizations.html

Configuring postfix to use an SMTP relay

If you are like me and your ISP blocks SMTP outbounnd traffic then you need to configure your mail client to use an SMTP relay to get around this problem.  Here are the steps.
 
vi /etc/postfix/main.cf
do a search for relayhost = and change it to your SMTP server of your ISP see my example below.
relayhost = smtp.west.cox.net
/etc/init.d/postfix restart