1

I just asked this question here regarding sending email from Windows server. Got the answer that the php.ini file has to be configured. After reading a little bit more, I found out about ini_set() function in PHP. So I tried to use it like that:

ini_set('SMTP', 'mail.mysite.com');
ini_set('smtp_port', 25);
ini_set('auth_username', 'me@mysite.com');
ini_set('auth_password', 'mypass');
ini_set('sendmail_from', 'me@mysite.com');

function send_contact_form($strName, $strEmail, $strPhone, $strMessage)
{
    $to = 'mymail@mysite.com';
    $subject = 'From the site';
    $message =  '<html lang="HE">
        <head>
        <title>
            '.$subject.'
        </title>
        </head>
        <body style="text-align:right; direction:rtl; font-family: Arial;">
            Name: '.$strName.'<br>Email: '
            .$strEmail.'<br>Phone: '.$strPhone
            .'<br><br>Message: <br>'.$strMessage.'
        </body>
    </html>';       
    $email = $strEmail;
    $header  = 'MIME-Version: 1.0' . "\r\n";
    $header .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
    $header .= "From: $email\r\nReply-To: $email" . "\r\n";

    mail($to, $subject, $message, $header);
}

However, I still don't receive any email. What am I doing wrong? Why is it not working?

Community
  • 1
  • 1
Igal
  • 5,833
  • 20
  • 74
  • 132

0 Answers0