By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,703 Members | 1,673 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,703 IT Pros & Developers. It's quick & easy.

Send Text with PHP, Port 25 block issue

P: 7
After a 2 day stalemate, I seek help!
I use WindowsXP. I live in Canada and my ISP is SaskTel. Through telnet command, it showed that they do block port 25.

I am doing a microcontroller project, that connects to a laptop, and I want to send a text when something happens.

PHP file:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <?PHP
  5.      $subject = "Text Message Subject";
  6.      $message = "Text Message Content"; 
  8.      //SENDS TEXT MESSAGE TO 509-863-4212
  9.      mail("",$subject,$message,"From:");
  10. ?>
  11. </body>
  12. </html>


I know the email is right, as i sent a text to my phone from my hotmail account.

I do not understand webservers well.. currently I am using "EasyPHP", and have my .php file in a directory, and using the path


I get an error saying "mail function isnt working with port 25, check your SMTP ..."

I have read many forums, and they all say that my ISP has it blocked. I also searched long and hard for how to get around this issue. Is it actually possible? Changing ISP is not an option. Can someone point me in a good direction with some handy tips? Anything, I am very exhausted at this point

Thank you,

Feb 26 '09 #1
Share this Question
Share on Google+
6 Replies

P: 88
Your trying to send from your own machine and you do not have a mail server running on it hence the reason port 25 is shut.

Do you have an account anywhere you POP/SMTP? If so you can use PHPMailer to send via that mail server.
Feb 26 '09 #2

P: 7
Thanks for reply

No i do not. Can i make an account somewhere?
Feb 26 '09 #3

P: 88
Do you not have an email account with your ISP? PHPMailer would allow you to configure your username/pass so you can auth through their mail server and send the email.

I guess you can either run your own mail server or try or find someone who will allow you to send mail through their server via POP before SMTP. You could also look for a free web PHP host who allow email to be sent as well and use that as a 3rd party to send the mails from.
Feb 26 '09 #4

P: 7

I called my ISP, and we set up an email account. He gave me the information on the smtp name, and a user name and pass. He also said that port 587 is open for me. Does this change anything?

My php file now look like:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <?php
  4. require("class.phpmailer.php");
  6. $mail = new PHPMailer();
  8. $mail->IsSMTP(); // send via SMTP
  9. $mail->Host = ""; // SMTP servers
  10. $mail->SMTPAuth = true; // turn on SMTP authentication
  11. $mail->Username = "joh"; // SMTP username
  13. $mail->Password = "abc"; // SMTP password
  15. $mail->From = "";
  16. $mail->FromName = "John";
  17. $mail->AddAddress("","Waste");
  18. $mail->AddReplyTo("","Your Name");
  20. $mail->WordWrap = 50; // set word wrap
  22. $mail->IsHTML(true); // send as HTML
  24. $mail->Subject = "Here is the subject";
  25. $mail->Body = "This is the HTML body";
  26. $mail->AltBody = "This is the text-only body";
  28. if(!$mail->Send())
  29. {
  30. echo "Message was not sent";
  31. echo "Mailer Error: " . $mail->ErrorInfo;
  32. exit;
  33. }
  35. echo "Message has been sent";
  37. ?>
  39. </body>
  40. </html>

Using the PHPMailer class.

I still get the same port error. Is there a step i am missing? At what point am i "connecting to the mail server"
Feb 26 '09 #5

Expert 5K+
P: 6,050
PHPMailer is old and out of date. Check out SwiftMailer.

Also, please use [code] tags when posting code. [code] ... [/code].

Thank you,

Feb 26 '09 #6

Expert Mod 5K+
P: 8,639
since port 587 is not the standard port for smtp, you need to tell SwiftMailer (or any mailer class used) that you want to connect using this port.
Feb 27 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.