Sending mail from a Bash shell script

前端 未结 12 1499
梦毁少年i
梦毁少年i 2021-01-29 22:54

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. The

12条回答
  •  被撕碎了的回忆
    2021-01-29 23:31

    sendEmail is a script that you can use to send email from the command line using more complicated settings, including connecting to a remote smtp server: http://caspian.dotconf.net/menu/Software/SendEmail/

    On OSX it is easily installable via macports: http://sendemail.darwinports.com/

    Below is the help page for the command, take note of the -s, -xu, -xp flags:

    Synopsis:  sendEmail -f ADDRESS [options]
    
    Required:
      -f ADDRESS                from (sender) email address
      * At least one recipient required via -t, -cc, or -bcc
      * Message body required via -m, STDIN, or -o message-file=FILE
    
    Common:
      -t ADDRESS [ADDR ...]     to email address(es)
      -u SUBJECT                message subject
      -m MESSAGE                message body
      -s SERVER[:PORT]          smtp mail relay, default is localhost:25
    
    Optional:
      -a   FILE [FILE ...]      file attachment(s)
      -cc  ADDRESS [ADDR ...]   cc  email address(es)
      -bcc ADDRESS [ADDR ...]   bcc email address(es)
    
    Paranormal:
      -xu USERNAME              authentication user (for SMTP authentication)
      -xp PASSWORD              authentication password (for SMTP authentication)
      -l  LOGFILE               log to the specified file
      -v                        verbosity, use multiple times for greater effect
      -q                        be quiet (no stdout output)
      -o NAME=VALUE             see extended help topic "misc" for details
    
    Help:
      --help TOPIC              The following extended help topics are available:
          addressing            explain addressing and related options
          message               explain message body input and related options
          misc                  explain -xu, -xp, and others
          networking            explain -s, etc
          output                explain logging and other output options
    

提交回复
热议问题