php mail() script not working with https

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aserdp
Forum Newbie
Posts: 1
Joined: Tue Aug 26, 2008 6:27 pm

php mail() script not working with https

Post by aserdp »

Hi guys,
I know a lot of people here are php guru, so please help me sort out this problem.

I have a website and is configured to work with http and also with https.

I create a simple php mail() script, call mail.php

<?php

$to = "someone@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "others@mydomain.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";

?>

(Please note that the above mentioned emails are changed).

Now if I execute the above script through my browser, http://mydomain.com/test.php
I recieve the email in my gmail box. I see the log of my mail (postfix). It shows deleivered. So all good there :)

Now if I execute the above script through my browser, https://mydomain.com/test.php
I dont recieve the email in my gmail box :( and if I check the logs, there is no entry for the mail. :banghead:

Please guys help me to sort it.

with regards
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php mail() script not working with https

Post by Christopher »

It sounds like mail is not configured correctly for the PHP mail() function on your system. Have you read the manual page and through the comments there?

http://us2.php.net/manual/en/function.mail.php
(#10850)
Post Reply