nsForum logo

Welcome Guest ( Log In )

 
Closed TopicStart new topic
> Php Mail() Issue, PHP mail function not working
snutting
post Jun 3 2009, 10:18 AM
Post #1





Group: Verified NS Member
Posts: 5
Joined: 3-June 09
Member No.: 4,535



I have mail form scripts using php mail() that were working up until recently and then they stopped. I have tried sending to multiple emails addresses to see if there was an issue there but none of my accounts received any emails. I talked with support and they created a ticket and he did mention something about blacklisting but did not give me all the info on that or if that was even a problem. Anyone have any ideas what may be going on?

DOMAIN: www.ctdermpc.com
Go to the top of the page
 
+Quote Post
EngineerMonster
post Jun 3 2009, 11:26 AM
Post #2





Group: Root Admin
Posts: 1,401
Joined: 10-August 07
From: St. Louis, MO
Member No.: 4



Hi snutting,

I checked your servers ip address at http://mxtoolbox.com/blacklists.aspx?IP=208.98.128.11 based off of your domain name - you do not appear to be blacklisted. For info on this checkout http://www.timeforblogging.com/2007/09/14/...pam-blacklists/

Odds are the messages are getting dropped in your spam folder though. I would check the from address that you are setting in your mail script. Then go to your email client and add that address to the address book and mark it as a safe sender. By doing this it will ensure that the message gets delivered. Then test again, if you get the message you will then see that it had blocked you into their spam even though you were not blacklisted.

Other than this if the mail doesn't come through I would look at enabling errors via php and see if you get any error messages back when you send the message and I would also look at your log files to see if there are any errors there from sending such as it cannot connect to the smtp server, etc.

Joe
Go to the top of the page
 
+Quote Post
snutting
post Jun 3 2009, 12:04 PM
Post #3





Group: Verified NS Member
Posts: 5
Joined: 3-June 09
Member No.: 4,535



Here is all my script that I am using to test does:

<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
$elog= dirname(__FILE__) . '/error_log.txt';
ini_set('error_log', $elog);
$stat=mail("MYEMAILADDRESS","TEST","TEST","From: \"CTDerm PC Website\"<website@ctdermpc.com>\r\n");
print "mail: ".$stat;
?>

The $stat comes back every time with a 1. I do not get any errors at all. The email according to PHP seems to be sent but I do not get any emails to 3 separate accounts(1 local, 1 gmail, 1 yahoo) that I send to. And there is no spam emails received for any of them either. Like I said before this was working fine with absolutely no changes until recently. I have not touched this site's scripts at all for months but now it is failing.

NOTE: The mail records are not hosted with Network Solutions only the website is. The MX records point to a local outlook server. Not sure if that makes any difference? Also note it has been this way since this site was setup and has functioned and sent emails fine in the past.
Go to the top of the page
 
+Quote Post
Guest_Duane_*
post Jun 3 2009, 12:31 PM
Post #4





Guests






QUOTE (snutting @ Jun 3 2009, 01:22 PM) *
Here is all my script that I am using to test does:

<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
$elog= dirname(__FILE__) . '/error_log.txt';
ini_set('error_log', $elog);
$stat=mail("MYEMAILADDRESS","TEST","TEST","From: \"CTDerm PC Website\"<website@ctdermpc.com>\r\n");
print "mail: ".$stat;
?>

The $stat comes back every time with a 1. I do not get any errors at all. The email according to PHP seems to be sent but I do not get any emails to 3 separate accounts(1 local, 1 gmail, 1 yahoo) that I send to. And there is no spam emails received for any of them either. Like I said before this was working fine with absolutely no changes until recently. I have not touched this site's scripts at all for months but now it is failing.

NOTE: The mail records are not hosted with Network Solutions only the website is. The MX records point to a local outlook server. Not sure if that makes any difference? Also note it has been this way since this site was setup and has functioned and sent emails fine in the past.

I tested your hosting package and confirmed the issue you are experiencing; there is some issue with the mail() function on your hosting package.
I've escalated this for resolution.

Also, if you change your scripting to use PEAR::Mail instead of the mail() function, it is currently working properly on your package, and will nearly always deliver the messages faster than using mail().
Go to the top of the page
 
+Quote Post
snutting
post Jun 3 2009, 12:44 PM
Post #5





Group: Verified NS Member
Posts: 5
Joined: 3-June 09
Member No.: 4,535



Tried this and it did not send emails to any accounts I entered in:

<?php
ini_set('display_errors', 1);
include('Mail.php');
$mail = Mail::factory("mail");
$headers = array("From"=>"website@ctdermpc.com", "Subject"=>"Test Mail");
$body = "This is a test!";
$mail->send("MYEMAILADDRESS", $headers, $body);
?>

Is this syntax correct? Can I get a copy of the script you tested that worked using PEAR?

Thanks for the help!
Go to the top of the page
 
+Quote Post
snutting
post Jun 3 2009, 01:24 PM
Post #6





Group: Verified NS Member
Posts: 5
Joined: 3-June 09
Member No.: 4,535



I did get this working:

include('Mail.php');
$headers['From'] = "website@ctdermpc.com";
$headers['To'] = "MYEMAILADDRESS";
$headers['Subject'] = "test subject";
$params["host"] = "localhost";
$params["port"] = "25";
$params["auth"] = false;
$params["username"] = "username";
$params["password"] = "password";

$mail_object =& Mail::factory('smtp', $params);
$mail_object->send($email, $headers, $body);

if (PEAR::isError($mail_object)) {
return false;
} else {
return true;
}
Go to the top of the page
 
+Quote Post
Guest_Duane_*
post Jun 3 2009, 01:32 PM
Post #7





Guests






QUOTE (snutting @ Jun 3 2009, 02:42 PM) *
I did get this working:

include('Mail.php');
$headers['From'] = "website@ctdermpc.com";
$headers['To'] = "MYEMAILADDRESS";
$headers['Subject'] = "test subject";
$params["host"] = "localhost";
$params["port"] = "25";
$params["auth"] = false;
$params["username"] = "username";
$params["password"] = "password";

$mail_object =& Mail::factory('smtp', $params);
$mail_object->send($email, $headers, $body);

if (PEAR::isError($mail_object)) {
return false;
} else {
return true;
}

yes, this is the correct format. You can also see a test script I wrote that is published to your package named PHPmailer.php.

You can use this to verify your scripts as well.
Go to the top of the page
 
+Quote Post
dmgatwork
post Dec 14 2014, 11:11 PM
Post #8





Group: Verified NS Member
Posts: 21
Joined: 30-August 10
Member No.: 10,968



QUOTE (Duane @ Jun 3 2009, 01:32 PM) *
yes, this is the correct format. You can also see a test script I wrote that is published to your package named PHPmailer.php.

You can use this to verify your scripts as well.



Is phpmailer installed for all users or do I have to installed it on my directory? I've tried the same test script using my information and I do not get a true or false return.

Could I please get the test script sent to me so I can test phpmailer on my site to validate it is working?

Thanks
Don
Go to the top of the page
 
+Quote Post
dmgatwork
post Dec 14 2014, 11:45 PM
Post #9





Group: Verified NS Member
Posts: 21
Joined: 30-August 10
Member No.: 10,968



QUOTE (dmgatwork @ Dec 14 2014, 11:11 PM) *
Is phpmailer installed for all users or do I have to installed it on my directory? I've tried the same test script using my information and I do not get a true or false return.

Could I please get the test script sent to me so I can test phpmailer on my site to validate it is working?

Thanks
Don


I did get it to work, the $email was not set in the example and when I gave it my TO email address it worked.

My Question now is:

Is this actually using STMP or should I be using a different include and process. The basic php mail function is getting my email to the users, too many ending up in the junk email bucket.

Thanks
Don
Go to the top of the page
 
+Quote Post
ecomIanS
post Dec 28 2014, 08:50 PM
Post #10





Group: Administrators
Posts: 967
Joined: 14-January 13
From: Jacksonville, FL
Member No.: 19,888



FYI this post is from 2009. I've closed it so you can make a new topic that is relevant to your specific issue with current responses.
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic
Tags
No Tag inserted yet

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version    Network Solutions © 2011 Time is now: 15th December 2017 - 05:06 AM
Domain Names | Web Hosting | Web Design | Shopping Cart Software | Online Marketing | SSL Certificates