AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
Expand all | Collapse all

send mail on Unix

  • 1.  send mail on Unix

    Posted Wed August 16, 2006 04:54 AM

    Originally posted by: SystemAdmin


    Hi all,

    Can anybody give me the command to send an e-mail on Unix ?
    And on which protocol runs this command ?

    Thaks in advance,
    dtrm


  • 2.  Re: send mail on Unix

    Posted Wed August 16, 2006 11:15 AM

    Originally posted by: SystemAdmin


    Mail on Unix is based on SMTP (port 25 - Simple Mail Tranfer Protocol).
    AIX comes with a couple of mail client programs - mail, dtmail, and you can get other programs from open source like pine that can handle attachments. You can also send a file directly with 'sendmail'. By default the sendmail daemon will be running to receive mail. You likely need to configure sendmail.cf file to get mail to go to the right place and to receive mail. Support line should be able to talk you through setting it up with the mail server, domain, hostname, and the like. Sendmail really likes to have a good DNS server working with the proper A records as well.


  • 3.  Re: send mail on Unix

    Posted Thu August 17, 2006 08:14 AM

    Originally posted by: SystemAdmin


    Thank you.
    By the way, do you know how to look for the return code after sending a mail ?


  • 4.  Re: send mail on Unix

    Posted Thu August 17, 2006 08:49 AM

    Originally posted by: SystemAdmin


    If you send with 'mail -v' or 'sendmail -v' then you will get output to the screen telling you exactly where the mail was sent - what server and if it was accepted there. IT still can get rejected later, in which case the sender will get an email back saying the mail could not be delivered.

    There is also a mail log, and you can turn on mail debug in syslog.conf to see every message sent and related errors


  • 5.  Re: send mail on Unix

    Posted Fri August 18, 2006 05:53 AM

    Originally posted by: SystemAdmin


    after sending a mail with -v , i get this message

    WARNING: local host name (mys_host_name) is not qualified; fix $j in config file
    root... WARNING: cannot open alias database /etc/mail/aliases; reading text version
    /dead.letter... Saved message in /dead.letter

    so i suppose that i have to configure $j with something in the sendmail.cf ?
    i've tried to rebuild the aliases.db with sendmail -bi, but it also failed with

    sendmail -bi

    WARNING: local host name (my_host_name) is not qualified; fix $j in config file
    WARNING: World writable directory /var
    WARNING: Group writable directory /var/spool
    WARNING: Group writable directory /var/spool/mqueue
    WARNING: World writable directory /etc
    WARNING: World writable directory /etc/mail
    newaliases: cannot open /etc/mail/aliases: Group writable file

    thks,


  • 6.  Re: send mail on Unix

    Posted Fri August 18, 2006 06:35 AM

    Originally posted by: SystemAdmin


    or maybe have i change something in the /etc/hosts on the localhost ?
    i'm a little bit confused because it's a new subject for me...


  • 7.  Re: send mail on Unix

    Posted Fri August 18, 2006 09:46 AM

    Originally posted by: SystemAdmin


    You are getting to back and forth details that would bests be handled by calling support line.
    It sounds like your hostname and domain are not defined in a properly configured DNS server. You really should get DNS working before you try to get mail working. Normally you would not solve this by defining your hostname.

    1. nslookup my_host_name
    Server: ausdns01.srv.ibm.com
    Address: 9.0.7.1

    • ausdns01.srv.ibm.com can't find my_host_name:Non-existent host/domain

    1. host my_host_name --- does this show your fully qualified hostname?
    The permissions on your /etc and /etc/mail directories look like they may be wrong

    1. sendmail -bi
    WARNING: Group writable directory /var/spool
    WARNING: Group writable directory /var/spool/mqueue
    /etc/mail/aliases: 4 aliases, longest 9 bytes, 57 bytes total
    1. ls -ld /etc
    drwxr-xr-x 35 root system 8192 Aug 09 14:39 /etc
    1. ls -ld /etc/mail
    drwxr-xr-x 2 root system 256 Jan 27 2006 /etc/mail
    1. ls -l /etc/mail/aliases
    -rw------- 1 root system 1384 Apr 20 2005 /etc/mail/aliases

    It is possible that you might be able so solve this issue by editing
    /etc/mail/sendmail.cf even if DNS is not working, but I would not guarantee this will work.

    Cwmy_host_name
    Dj$w.dept.company.com ($w + full domain)

    Another thing to try to see your defined macro's is to use sendmail in debug mode. This will show if your cononical name is defined.

    1. sendmail -d0.4 -bi
    Version AIX5.3/8.11.6p2
    Compiled with: _FFR_MILTER LDAPMAP MAP_REGEX LOG MATCHGECOS MIME7TO8
    MIME8TO7 NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS
    NISPLUS QUEUE SCANF SMTP USERDB XDEBUG
    canonical name: myhost.dfw.ibm.com
    a.k.a.: myhost
    a.k.a.: myhost.dfw
    UUCP nodename: myhost
    a.k.a.: myhost.dfw.ibm.com
    a.k.a.: IPADDRESS
    a.k.a.: http://127.0.0.1
    a.k.a.: ::1

    ============ SYSTEM IDENTITY (after readcf) ============
    (short domain name) $w = myhost
    (canonical domain name) $j = myhost.dfw.ibm.com
    (subdomain name) $m = dfw.ibm.com
    (node name) $k = myhost
    ========================================================

    WARNING: Group writable directory /var/spool
    WARNING: Group writable directory /var/spool/mqueue
    /etc/mail/aliases: 4 aliases, longest 9 bytes, 57 bytes total


  • 8.  Re: send mail on Unix

    Posted Fri August 18, 2006 11:24 AM

    Originally posted by: SystemAdmin


    thank you a lot! (i'd like to understand the problem before calling the support line;-))

    and that what i get after doing what you advise:

    #nslookup my_host_name
    Server:

    • can't find my_host_name:No response from server

    #host my_host_name => yes, it shows my fully qualified hostname
    my_host_name is 111.111.111.11, Aliases: my_alias_host_name (OK!)

    so, i've changed about permissions

    1. chmod 755 /etc
    2. ls -ld /etc
    drwxr-xr-x 27 root system 3584 Jul 11 11:07 /etc

    1. chmod 755 /etc/mail
    2. ls -ld /etc/mail
    drwxr-xr-x 2 root system 512 Jul 12 09:25 /etc/mail

    1. chmod 600 /etc/mail/aliases
    2. ls -l /etc/mail/aliases
    -rw------- 1 root system 1458 Aug 18 11:21 /etc/mail/aliases

    1. chmod 600 /etc/mail/aliases.db
    2. ls -ld /etc/mail/aliases.db
    -rw------- 1 root system 12288 Oct 15 2004 /etc/mail/aliases.db

    sendmail -bi
    /etc/mail/sendmail.cf: WARNING: dangerous write permissions
    WARNING: local host name (my_host_name) is not qualified; fix $j in config file
    WARNING: World writable directory /var
    WARNING: Group writable directory /var/spool
    WARNING: Group writable directory /var/spool/mqueue
    /etc/mail/aliases: 8 aliases, longest 9 bytes, 89 bytes total

    1. sendmail -d0.4 -bi
    Version AIX5.2/8.11.6p2
    Compiled with: LDAPMAP MAP_REGEX LOG MATCHGECOS MIME7TO8 MIME8TO7
    NAMED_BIND NDBM NETINET NETINET6 NETUNIX NEWDB NIS NISPLUS
    QUEUE SCANF SMTP USERDB XDEBUG
    canonical name: my_host_name
    UUCP nodename: my_alias_host_name
    a.k.a.: my_alias_host_name
    a.k.a.: http://111.111.111.11
    /etc/mail/sendmail.cf: WARNING: dangerous write permissions
    a.k.a.: http://127.0.0.1
    a.k.a.: ::1

    ============ SYSTEM IDENTITY (after readcf) ============
    (short domain name) $w = my_host_name
    (canonical domain name) $j = my_host_name
    (subdomain name) $m = <null>
    (node name) $k = my_host_name
    ========================================================

    WARNING: local host name (my_host_name) is not qualified; fix $j in config file
    WARNING: World writable directory /var
    WARNING: Group writable directory /var/spool
    WARNING: Group writable directory /var/spool/mqueue
    /etc/mail/aliases: 8 aliases, longest 9 bytes, 89 bytes total
    so i think that because of the $m that the $j is not ok ?
    do you know how to set the $m ?

    bests regards,



  • 9.  Re: send mail on Unix

    Posted Fri August 18, 2006 11:40 AM

    Originally posted by: SystemAdmin


    The problem is that you do not have a properly configured DNS. Set up DNS and all of the problem will go away.

    Did you add the line

    Dj$w.<your domain name>
    or
    Dj<your_host_fully_qualified_name>

    in the /etc/mail/sendmail.cf file?

    I think this will at least let $j show a full domain name for you host,
    but I don't think it will change the value of $m instead of
    (canonical domain name) $j = my_host_name (should show my_host_name.my_domain_name_

    Sendmail was designed to run with a DNS server and takes some work arounds
    when you don't have one. the $m comes from the A record on the DNS server.

    You can try to add a line in the sendmail.cf before the Dj line
    DmFoo.COM
    or
    Dm<my_domain_name>

    This MAY work. In the past you could not get sendmail to work without DNS,
    but it may be possible now.


  • 10.  Re: send mail on Unix

    Posted Fri August 18, 2006 12:18 PM

    Originally posted by: SystemAdmin


    excuse me if my question seems to be silly !;-)

    i am sending a mail from a unix server on a lan to my microsoft outlook on another network. so my $w is the host name is of the unix server.

    but what is my domaine name ?
    it is what is following the @ of my email adress ?
    it seems to be strange when i put them together ?! ;-()

    and how do you get the DNS working ? can i start it with the smit utility ?

    thks


  • 11.  Re: send mail on Unix

    Posted Fri August 18, 2006 12:26 PM

    Originally posted by: SystemAdmin


    Your domain name is going to be like where you receive your email.

    i.e. yourname@yahoo.com (where yahoo.com is the domain name)

    Yes you can start DNS through smitty you have to have a DNS server to point it towards.