The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mail uses hostsever name not $HOSTNAME

Discussion in 'E-mail Discussions' started by DGermancp, Feb 28, 2012.

  1. DGermancp

    DGermancp Active Member

    Joined:
    Feb 25, 2006
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NJ, USA
    cPanel Access Level:
    Reseller Owner
    Short story:
    echo "Database updated"|mail -s"New entry" joe@verizon.net
    generates email
    From: realger1@slmp-550-13.slc.westdc.net
    not my domain nor my subdomain nor $HOSTNAME


    Full story:
    I am hosted on the midphase server slmp-550-13.slc.westdc.net
    My primary domain is Real-World-Systems.com.
    I have a subdomain MHS1962.info.
    I have a form which runs a cgi which enters a row in a mysql database.
    I want to notify the person responsible for the project when the cgi is run, so the cgi includes.
    echo "Database updated"|mail -s"New entry" joe@verizon.net
    Currently he receives the message from the odd user: realger1@slmp-550-13.slc.westdc.net.
    I would like the email to come from MHS1962.info or at least from Real-World-Systems.com.

    /home2/realger1 > echo $HOSTNAME
    slmp-550-13.slc.westdc.net
    /home2/realger1 > export HOSTNAME="Real-World-Systems.com"
    /home2/realger1 > echo $HOSTNAME
    Real-World-Systems.com
    /home2/realger1 > dig $HOSTNAME +short
    174.127.119.33
    /home2/realger1 > dig +short -x 174.127.119.33
    real-world-systems.com.
    /home2/realger1 > echo $HOSTNAME | mail -s "`echo $HOSTNAME`" dgerman@real-world-systems.com

    results in an email with
    subject: Real-World-Systems.com
    body: Real-World-Systems.com
    from: realger1@slmp-550-13.slc.westdc.net


    Seems to me that this is a defect in software provided by a software package that claims to support multiple domains and subdomains.

    I do not have root access.
    Attemts to use sendmail report:
    "
    exim: permission denied
    "

    midphase hosting service support says:
    "
    ...email will send from realger1@slmp-550-13.slc.westdc.net.
    That is the default email address that is created for your account.
    That can not be changed
    "

    Three people from cPanel have been unable to help, ticket# 2347898.

    Any suggestions would be appreciated.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,468
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Sounds to me like some sort of coding issue with your script, instead. You might want to contact the author of the script for assistance.
     
  3. DGermancp

    DGermancp Active Member

    Joined:
    Feb 25, 2006
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NJ, USA
    cPanel Access Level:
    Reseller Owner
    Solved. :p
    Since sendmail seems to invoke exim, reading the documentation on sendmail is counter productive!
    For example the seemingly benign sendmap -bP does NOT print the number of entries in the queue (as the sendmail man page states) rather
    the values of all Exim’s main configuration options are output as per the exim documentation.

    What does work is:
    cat mailWithFromToSubjectBody | sendmail -t

    where mailWithFromToSubjectBody contains:

    From: dg@MHS1962.info
    To: dgerman@Real-World-Systems.com
    Subject: sendmail test
    This is a test of data sent to sendmail

    Thanks to DGermancp for the solution.
     
  4. DGermancp

    DGermancp Active Member

    Joined:
    Feb 25, 2006
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NJ, USA
    cPanel Access Level:
    Reseller Owner
    UNSOLVED! :(

    As of 11/23/12 sendmail is "command not found"

    This is still problem.
     
Loading...

Share This Page