0
<?php

if(isset($_POST['name'])){
    ini_set("SMTP", "aspmx.l.google.com");
    ini_set('smtp_port',587);

    $name = $_POST['name'];
    $email = $_POST['email'];
    $poruka = $_POST['poruka'];

    $message = "<p>Korisnik: $name, email: $email</p>";
    $message .= "<p></p>";
    $message .= "<p>$poruka</p>";

    $to_email = 'some@gmail.com';
    $subject = 'Poruka sa Srko';
    $headers = 'From: <syndria.doo@gmail.com>';
    
    if (mail($to_email, $subject, $message, $headers))
    {
        echo "Message accepted";
    }
    else
    {
        echo "Error: message not accepted";
    }
}

?>

The mail function won't send the email for some reason. It won't work with gmail but will send to mail from that server only.

j08691
  • 197,815
  • 30
  • 248
  • 265

0 Answers0