Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698289
Share on other sites

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 ";

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698291
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698311
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698315
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698334
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-698401
Share on other sites

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/...

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-699076
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/134146-mail-function/#findComment-699138
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.