OS X: sending mail to localhost

For testing purposes, I want to send mail to my localhost user account, and not to my web server. I am not sure how to do this using mail.app. Any help would be appreciated.

+5
source share
6 answers

Unless you specifically want to use Mail.app, you can send mail using the command mail. Open a terminal and:

mail -s "Testing" `whoami`@`hostname`
<type something>
Ctrl-D to finish and send

These are backticks, not single quotes. whoamireturns the current username of the user and hostnamereturns the host name of the local computer. It can also be explicit:

mail -s "Testing" john@mymac.local

: . Mail.app ~/Mail, SQLite ( Envenlope Index). , , mailboxes messages. /. , , , Mail.app( ).

- Mail.app, mbox , , dbr. , , script - .

+6

@Tautologistics

OSX MTA (SMTP-), , :

sudo launchctl start org.postfix.master   

localhost,


, SMTP-, 10.6.1

>telnet 127.0.0.1 25
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

>sudo launchctl start org.postfix.master

>telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 machinename.example.com ESMTP Postfix
+16

() , . , , , , .

POP3/IMAP, UNIX' mbox. , /var/mail/ ( - )

..

$ mail dbr
Subject: hi
test
^d # ctrl+d (EOF)
$ cat /var/mail/dbr 
From dbr@parabola.local  Tue Dec 30 13:43:57 2008
Return-Path: <dbr@parabola.local>
X-Original-To: dbr
Delivered-To: dbr@parabola.local
Received: by parabola.local (Postfix, from userid 501)
        id 4FEA1158E36; Tue, 30 Dec 2008 13:43:57 +1030 (CST)
To: dbr@parabola.local
Subject: hi
Message-Id: <20081230031357.4FEA1158E36@parabola.local>
Date: Tue, 30 Dec 2008 13:43:57 +1030 (CST)
From: dbr@parabola.local (dbr)

test

Ruby ( , , , , ), , Python maildir.mbox, :

>>> msgs = mailbox.mbox("/var/mail/dbr")
>>> for msg in msgs:
...     print "Subject:", msg['subject']
... 
Subject: hi
+2

OSX Server, SMTP/IMAP/POP3, . Post Fix Enabler , , MacPorts postfix:

sudo port install postfix
+1

localhost LocalhostMail - Mac OS X, PHP- ( , ) Mail.app, Mac OS X. PHP, MySQL , Mail. LocalhostMail Mail.app , SMTP- . localhostmail.com

+1

codelogic, thanks, I really knew about sending mail from the terminal. I think my question was not thought out. I am looking for access to my (local) mail server, access to the mailbox and parsing. So, I assume that the mail server is running locally, but not sure how to access it. I am using ruby:

pop = Net::POP3.new 'macbook.local'
pop.start 'me', 'mypass'

but we get Timeout::Error: execution expired

0
source

All Articles