OS X: sending mail to localhost

前端 未结 6 785
臣服心动
臣服心动 2021-02-04 20:07

For testing purposes I want send mail to my localhost user account rather than my webserver. I am unsure how to do this using mail.app. Any help would be appreciated.

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 20:39

    If you don't specifically want to use Mail.app, you can send mail using the mail command. Open Terminal and:

    mail -s "Testing" `whoami`@`hostname`
    
    Ctrl-D to finish and send
    

    Those are backticks, not single quotes. whoami returns the current user's username and hostname returns the local machine's hostname. It could also be explicit:

    mail -s "Testing" john@mymac.local
    

    EDIT: Just read your clarification. Mail.app stores it's data in ~/Mail, mostly in an SQLite database (the 'Envenlope Index' file). The tables of interest would be mailboxes and messages. The text of the email is stored in individual files in the respective mailbox/folder directories. This would probably be the way to go, if you want to access email that has been fetched by Mail.app (in realtime).

    Yet another option would be to export your mail from the Mail.app using the mbox format and access it using the technique described by dbr. Depending on whether or not realtime access is desired, you might be able to script something up that automates the export.

提交回复
热议问题