Jump to content

[Solved] Php Mail() Function Doesn't Work


FabianK

Recommended Posts

I always get this error:

Warning: mail() [function.mail]: Could not execute mail delivery program '/usr/sbin/sendmail -t -i' in /home1/fabiank/public_html/test.php on line 5

 

<?php
$to = "email@mail.com";
$message = "This is a test!";
$subject = "Test Mail";
if (mail($to, $subject, $message)) {
echo("message sent!");
} else {
echo("message not sent!");
}
?>
Link to comment
Share on other sites

So weird. The error seems widespread and there is no single fix. Some people say it's a misconfiguration in php.ini, others sendmail.ini, still some say that PHP isn't sending From: headers and that's the cause. There was a topic on this on the cPanel boards but that issue affected all users on a server, so I doubt it applies here since Byron and I had our test scripts work.

Link to comment
Share on other sites

Not only is php mail function working, your exact file is working on your account. I copied your test.php to test2.php and changed your email address to my hotmail account and here is the result of visiting the page in a browser:

message sent!

Here is the email I received:

x-store-info:fHNTDlzCF8Nxw6HwcfGQy+S7Ax/lqLSmNphQ3OF+T9E=
Authentication-Results: hotmail.com; spf=none (sender IP is 65.19.143.2) smtp.mailfrom=fabiank@stevie.heliohost.org; dkim=none header.d=fabian.heliohost.org; x-hmca=none
X-SID-PRA: fabian@fabian.heliohost.org
X-AUTH-Result: NONE
X-SID-Result: NONE
X-Message-Status: n:n
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTE7YT0wO0Q9MjtHRD0yO1NDTD00
X-Message-Info: 2etWe3f/w1eCAIY8IUcwYEh3b9UZmmS6hXHLrcj3OU1dIjB0s5r3HPSe+dmpYJTK26PY9bEOFgSe0lwq83ErR20e8TDUKycyGaMJlrl88gIeJ5xIpQmQyHh8znrsom7EYz8E6KCEixWLiz/bT6riR2uja4jzgIvY
Received: from stevie.heliohost.org ([65.19.143.2]) by COL0-MC1-F30.Col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4900);
 Sat, 1 Dec 2012 15:06:58 -0800
Received: from fabiank by stevie.heliohost.org with local (Exim 4.69)
(envelope-from <fabiank@stevie.heliohost.org>)
id 1Tew9a-00030x-1S
for [redacted]@hotmail.com; Sat, 01 Dec 2012 15:06:57 -0800
To: [redacted]@hotmail.com
Subject: Test Mail
From:fabian@fabian.heliohost.org
Message-Id: <E1Tew9a-00030x-1S@stevie.heliohost.org>
Date: Sat, 01 Dec 2012 15:06:57 -0800
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - stevie.heliohost.org
X-AntiAbuse: Original Domain - hotmail.com
X-AntiAbuse: Originator/Caller UID/GID - [22306 32003] / [47 12]
X-AntiAbuse: Sender Address Domain - stevie.heliohost.org
X-Source: /usr/bin/php
X-Source-Args: /usr/bin/php /home1/fabiank/public_html/test2.php 
X-Source-Dir: fabian.heliohost.org:/public_html
Return-Path: fabiank@stevie.heliohost.org
X-OriginalArrivalTime: 01 Dec 2012 23:06:58.0916 (UTC) FILETIME=[90B49A40:01CDD018]

This is a test!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...