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.

Enable SMTP Authentication for PHP Mail

Discussion in 'E-mail Discussions' started by wqqar, Jan 6, 2011.

  1. wqqar

    wqqar Registered

    Joined:
    Jan 24, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Previously users had to use SMTP Authentication in their code.
    i.e. following fields

    from:
    host:
    username:
    password:

    ----------------------------------
    I think after update 11.28

    SMTP authentication is enabled and I've checked that I cannot send email via any email client without using SMTP authentication. I've also checked it via telnet and it confirms it.

    But, if following code is used in a PHP file to send email it sends it. Even if the from: address / domain does not exist on the server.

    PHP:

    <?
        $to = "xxxxxxx@gmail.com";
        $from = 'anyone@fakedomain.com';
        $subject = "Mail Subject";    

        $message = 'This is a test message';

        $headers = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=windows-1253, UTF-8\r\n";
        $headers .= 'From: '.$from;
                
        if (mail($to, $subject, $message, $headers))
            {
                echo "Email Sent : ". $to;
            }    
        else
            {
                echo "Error Sending Email : ". $to;
            }

    ?>

    --
    I also check the eximmainlog and it appears that the from: address being used to send these emails is the main user account.
    I want to revert it back, as it was earlier that no one can send email without using SMTP authentication in the code.

    Your help is highly appreciated.

    --
    Waqar
     
  2. wqqar

    wqqar Registered

    Joined:
    Jan 24, 2005
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    No one encountered above issue ?

    --
    Waqar
     
  3. Indianets

    Indianets Well-Known Member

    Joined:
    Jun 13, 2008
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hello,

    Do you have "SMTP TWEAK" disabled in your WHM?

    Try enabling that and check once. Also, if you are using CSF you would like to set SMTP_ALLOWLOCAL = "0" instead.

    Vijay
     
Loading...

Share This Page