0

i have created mail server in exchange server 16 and i am trying to connect using smtp server

smtp port : 25 or 587 smtp server: smtp.xxx.mail.mil

i have written complete code using php mail function but

if(mail($to,$subject,$message,$headers))
    {
        echo "Mail Send Sucuceed";
    }
    else{
        echo "Mail Send Failed";    
    }

The code works fine for gmail but doesnt work with exchange. Any one can help me with the correction or alternative also i want to send mail in a particular lab network which is created.

kak
  • 3
  • 2
  • This code doesn't show how you configured your sendmail to point to that SMTP. And "doesn't work" isn't an error message, problem statement, or log report, therefore we have no idea what specifically is going wrong. So we can't help with that. I think you would be better using PHPMailer anyway and putting the SMTP connection details directly in the PHP code. – ADyson Mar 19 '21 at 10:09
  • 1
    I would recommend you to look into some tried and tested mail library, like PHPMailer or SwitfMailer instead of using the low level `mail()`-function. With those, you configure everything in your code, so you don't need to mess around with server configs. Not only does it make it easier to see what's going on, but it also makes your code way more portable. – M. Eriksson Mar 19 '21 at 10:10

0 Answers0