PDA

View Full Version : send email from command line


mierdatuti
1st March 2008, 02:50
Hi,

I woud like to kwow how I must configure ubuntu and what aplications I must install it to can send email from command line

Thanks a lot and sorry for my english

topdog
1st March 2008, 10:31
You need to install mailx which will install exim4 as the mta, am sure you could use nullmailer too

mierdatuti
1st March 2008, 10:50
Well

I have installed mailx bat when I try to send an email from command-line the program don't answer

mail -s "some subject" direccion@gmail.com < hola


I don't have to configure anything?

Thansks

topdog
1st March 2008, 10:53
Take a look at the mail logs. What kind of setup is your server because if its a test server on DSL or dialup you may need to relay mail via your ISP mail server.

mierdatuti
1st March 2008, 12:49
I have a pc with ubuntu and a DSL connection.

I send a mail using:
mail -s "some subject" davidtuti@gmail.com < message_body.txt

And the logs says me:

Mar 1 11:45:11 david-desktop postfix/master[6187]: daemon started -- version 2.4.5, configuration /etc/postfix
Mar 1 11:45:24 david-desktop postfix/pickup[6188]: B1C4EAC44D: uid=0 from=<root>
Mar 1 11:45:24 david-desktop postfix/cleanup[6194]: B1C4EAC44D: message-id=<20080301104524.B1C4EAC44D@david-desktop>
Mar 1 11:45:24 david-desktop postfix/qmgr[6189]: B1C4EAC44D: from=<root@gmail.com>, size=297, nrcpt=1 (queue active)
Mar 1 11:45:24 david-desktop postfix/local[6196]: B1C4EAC44D: to=<davidtuti@gmail.com>, relay=local, delay=0.05, delays=0.03/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "davidtuti")
Mar 1 11:45:24 david-desktop postfix/cleanup[6194]: BB053AC44E: message-id=<20080301104524.BB053AC44E@david-desktop>
Mar 1 11:45:24 david-desktop postfix/bounce[6197]: B1C4EAC44D: sender non-delivery notification: BB053AC44E
Mar 1 11:45:24 david-desktop postfix/qmgr[6189]: BB053AC44E: from=<>, size=1947, nrcpt=1 (queue active)
Mar 1 11:45:24 david-desktop postfix/qmgr[6189]: B1C4EAC44D: removed
Mar 1 11:45:24 david-desktop postfix/local[6196]: BB053AC44E: to=<david@gmail.com>, orig_to=<root@gmail.com>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Mar 1 11:45:24 david-desktop postfix/qmgr[6189]: BB053AC44E: removed

The email don't arrive, any help?

topdog
1st March 2008, 15:09
Post your postfix config lets see, seems like your server is accepting mail for gmail as a local domain which it should not.

mierdatuti
1st March 2008, 15:56
root@david-desktop:/etc/postfix# postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = gmail.com, david-desktop, localhost.localdomain, localhost
myhostname = david-desktop
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
recipient_delimiter = +
relayhost = smtp.gmail.com:587
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtpd_use_tls = yes

Thansk for your help

topdog
1st March 2008, 15:59
You will not be able to send mail to gmail until you change this
mydestination = gmail.com, david-desktop, localhost.localdomain, localhost

To this
mydestination = david-desktop, localhost.localdomain, localhost