josh.php Posted November 25, 2008 Share Posted November 25, 2008 So I have tried so many things to get PHP to send emails with the mail() function. Right now I am using some program called argosoft mail server. has a web interface for getting emails and everything. In my php.ini file, the smtp server is set to localhost, since the program acts as a smtp server. It uses the smtp port 25, and all i get when i go to the page i made to send a test email, is it keeps saying loading and never finishes. Ive tried using my ISP's smtp server, which is Comcast. I still get nothing, even when I use the send from address as my comcast email. Anybody have any insight, or just want to tell me the best way to get it to work. Ill do anything at this point! Thank You! Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/ Share on other sites More sharing options...
btherl Posted November 25, 2008 Share Posted November 25, 2008 Can you post your code? Edit: And your OS, and version of php please It may well be a firewalling issue and that's very OS dependent. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698284 Share on other sites More sharing options...
premiso Posted November 25, 2008 Share Posted November 25, 2008 So I have tried so many things to get PHP to send emails with the mail() function. Right now I am using some program called argosoft mail server. has a web interface for getting emails and everything. In my php.ini file, the smtp server is set to localhost, since the program acts as a smtp server. It uses the smtp port 25, and all i get when i go to the page i made to send a test email, is it keeps saying loading and never finishes. Ive tried using my ISP's smtp server, which is Comcast. I still get nothing, even when I use the send from address as my comcast email. Anybody have any insight, or just want to tell me the best way to get it to work. Ill do anything at this point! Thank You! I know that Comcast, non-business blocks port 25. That very well may be the problem. Your only option is to switch or upgrade to the business line of comcast. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698289 Share on other sites More sharing options...
josh.php Posted November 25, 2008 Author Share Posted November 25, 2008 windows server 2003 with PHP Version 5.2.6 and the code is: <?php // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to="josh@localhost"; // Your subject $subject="Test"; // From $header="from: your name <your email>"; // Your message $message="Hello \r\n"; $message.="This is test\r\n"; $message.="Test again "; // send email $sentmail = mail($to,$subject,$message,$header); // if your email succesfully sent if($sentmail){ echo "Email Has Been Sent ."; } else { echo "Cannot Send Email "; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698291 Share on other sites More sharing options...
premiso Posted November 25, 2008 Share Posted November 25, 2008 As mentioned above, if you have comcast chances are they are blocking it. Do you have the business class or personal class connection? My bet is you have personal class and that is the problem. There is nothing wrong with the code. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698295 Share on other sites More sharing options...
josh.php Posted November 25, 2008 Author Share Posted November 25, 2008 well i do have the personal, but what about using a different port? how could i go about that? Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698296 Share on other sites More sharing options...
btherl Posted November 25, 2008 Share Posted November 25, 2008 Google showed up some interesting snippets, especially this one http://russj.livejournal.com/43575.html By the sounds of it, you'll need to configure your local smtp software to use comcast's smtp server as a relay. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698298 Share on other sites More sharing options...
premiso Posted November 25, 2008 Share Posted November 25, 2008 http://www.davecolorado.com/index.php/comcast-blocks-my-email-on-port-25-because-of-spam/ Google is your friend. There is someone with the problem and alternate ports. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698299 Share on other sites More sharing options...
josh.php Posted November 25, 2008 Author Share Posted November 25, 2008 i still get this issue. go to joshphp.com the site works fine go to joshphp.com/mail.php it sits there and says waiting. i told php.ini to use smtp.comcast.net with port 587 as that article said and the from email is my comcast email. still same issue? any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698311 Share on other sites More sharing options...
premiso Posted November 25, 2008 Share Posted November 25, 2008 You would have to forward it for your router too (if you have one). And also make sure there is exception in any software firewall, like windows firewall for that port. As for if that port really works, I have no clue and I do not think he was using comcast's smtp I think he was using his own server on his own computer and just had to use that port for that server. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698315 Share on other sites More sharing options...
josh.php Posted November 25, 2008 Author Share Posted November 25, 2008 router forwards port 587 to my server. the server software is setup to monitor port 587 and php is setup for localhost with port 587. any ideas? still says loading Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698322 Share on other sites More sharing options...
premiso Posted November 25, 2008 Share Posted November 25, 2008 Nope, I hate messing with Mail servers. They just suck. Good luck! Maybe someone else can shine some light. In the mean time I would do some research via google if I were you. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698331 Share on other sites More sharing options...
josh.php Posted November 25, 2008 Author Share Posted November 25, 2008 well right now i got thunderbird to communicate with the program fine. the program cant send the email for some reason. it finds the mx server or whatever for gmail, where im sending the test, but it keeps looping. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698332 Share on other sites More sharing options...
btherl Posted November 25, 2008 Share Posted November 25, 2008 There's no need to direct 587 from outside back to your server, just 587 going out. php should be configured for smtp.comcast.net port 587, as in the documentation here: http://www.comcast.com/customers/faq/FaqDetails.ashx?ID=4240&fss=smtp If that doesn't work, then I would next try to find if the connection is actually getting through any pc and router firewalls you may have. That's difficult to test without some networking knowledge though. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698334 Share on other sites More sharing options...
josh.php Posted November 25, 2008 Author Share Posted November 25, 2008 that would work but in PHP how do you make it use smtp authentication? you need that enabled to use the SMTP server according to that documentation. Ive already seen that stuff but I dont think you can do it that way with PHP? Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698336 Share on other sites More sharing options...
btherl Posted November 25, 2008 Share Posted November 25, 2008 Oops, I didn't notice that .. I'm pretty sure php's built in mail doesn't do smtp auth. But the pear package does: http://pear.php.net/package/Mail There's also an smtp package if you want more control (but I'm guessing you just want to get it working). Here's that one: http://pear.php.net/package/Net_SMTP/docs/1.3.1/Net_SMTP/Net_SMTP.html Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698401 Share on other sites More sharing options...
josh.php Posted November 26, 2008 Author Share Posted November 26, 2008 im having some difficulty running with the pear module now.i get this message PHP has encountered a Stack overflow the code for the page is: <?php include('Mail.php'); $recipients = 'josh.php@gmail.com'; $headers['From'] = 'richard@example.com'; $headers['To'] = 'joe@example.com'; $headers['Subject'] = 'Test message'; $body = 'Test message'; $params['sendmail_path'] = '/usr/lib/sendmail'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('sendmail', $params); $mail_object->send($recipients, $headers, $body); ?> i ran go-pear.bat and it installed everthing. i dont know if i copied the mail folder to the right spot though. as of now it is in C:/php/pear/pear/mail/... Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-699076 Share on other sites More sharing options...
btherl Posted November 26, 2008 Share Posted November 26, 2008 You're running on windows right? I think you'll need the smtp mail object. Sendmail is a unix thing. Give it the hostname and port from comcast, as well as the auth information, and it ought to work. From the constructor method here it looks like you can give all of the auth data in the constructor itself. Oddly formatted documentation there, but it looks like it wants an array like you are passing to the mail factory in your latest post. Quote Link to comment https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-699138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.