send email from command line

Discussion in 'Installation/Configuration' started by mierdatuti, Mar 1, 2008.

  1. mierdatuti

    mierdatuti New Member

    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
     
  2. topdog

    topdog Active Member

    You need to install mailx which will install exim4 as the mta, am sure you could use nullmailer too
     
  3. mierdatuti

    mierdatuti New Member

    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" [email protected] < hola


    I don't have to configure anything?

    Thansks
     
  4. topdog

    topdog Active Member

    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.
     
  5. mierdatuti

    mierdatuti New Member

    I have a pc with ubuntu and a DSL connection.

    I send a mail using:
    mail -s "some subject" [email protected] < 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=<[email protected]>, size=297, nrcpt=1 (queue active)
    Mar 1 11:45:24 david-desktop postfix/local[6196]: B1C4EAC44D: to=<[email protected]>, 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=<[email protected]>, orig_to=<[email protected]>, 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?
     
  6. topdog

    topdog Active Member

    Post your postfix config lets see, seems like your server is accepting mail for gmail as a local domain which it should not.
     
  7. mierdatuti

    mierdatuti New Member

    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
     
  8. topdog

    topdog Active Member

    You will not be able to send mail to gmail until you change this
    Code:
    mydestination = gmail.com, david-desktop, localhost.localdomain, localhost
    To this
    Code:
    mydestination = david-desktop, localhost.localdomain, localhost
     

Share This Page