
- #MACOS SERVER MAIL SERVER PORTS HOW TO#
- #MACOS SERVER MAIL SERVER PORTS FOR MAC#
- #MACOS SERVER MAIL SERVER PORTS MAC OS#
SMTP_REPLY=(=OK =FAIL =FAIL =FAIL =FAIL =FAIL =FAIL =WAIT =DATA =SENT)įor (( i = 1 i /dev/tcp/$SMTP_HOST/$SMTP_PORT If you remove the call to 'dig' to obtain the mail relay, it is a 100% native Bash script. So call Sendmail like sendmail -OSMART_HOST=. I believe you can add configuration parameters on the command line.

You can specify the configuration file by the -C paramter. Sendmail will send directly to the receiving mail server (on port 25) unless you override it in the configuration file. bs is for running an SMTP server as a deamon. You probably don't want to use the -bs command unless you are sending it as raw SMTP like Martin's example. Mailer.login(SMTP_USERNAME, SMTP_PASSWORD) With smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as mailer: SMTP_FROM = '/script/output/my_attachment.txt' Consider using the stock installer or installing homebrew followed by brew install python.įrom there, customize the following script based on stock examples to suit your needs. Python and it's built-in standard library provides some nice facilities for sending email if you're willing to install it. This answer has been updated for modern systems, but is much more involved and exceeds the scope of the original poster's request. Since then, the Python ecosystem has evolved and Python is not available on a clean install.
#MACOS SERVER MAIL SERVER PORTS MAC OS#
Previously, this answer was based on the default inclusion of a recent Python on Mac OS X.
#MACOS SERVER MAIL SERVER PORTS HOW TO#
Update: I've found the -bs option for Sendmail which seems to be what I need, but I'm at a loss of how to specify settings.Īlso, to clarify, the reason I'd like to specify SMTP settings is that mails from localhost on port 25 sent out via Postfix would be blocked by most corporate firewalls, but if I specify the server and an alternate port I won't run into that problem.

Is it possible to do this in the script so it will run on a base Mac OS X install of 10.5.

The catch is I would like to deploy this script on multiple computers (10.5 and 10.6) without enabling Postfix on the computer. I figure to get around those shortcomings I should send the mail directly from the script by entering SMTP settings, address to send to, etc. It is dependent on Mail.app's account setup being valid in the future.It steals focus if Mail is not the current application.The automator application also attaches a text file that the script has written to.
#MACOS SERVER MAIL SERVER PORTS FOR MAC#
I am writing a Bash shell script for Mac that sends an email notification by opening an automator application that sends email out with the default mail account in Mail.app.
