Jump to content

PHP Mail function (I know, another one)


jewysi

Recommended Posts

I'm getting this error message which seems to be very common as I'm finding

reading through other posts, but I still haven't figured it out the solution.

 

This is the error message

 

Warning: mail() [function.mail]: Failed to connect to mailserver at

"localhost" port 25, verify your "SMTP" and "smtp_port" setting in

php.ini or use ini_set() in C:\wamp\www\email.php on line 13

 

I've seen the phpmailer class mentioned a few times and mention of setting

up the mail server.  This machine is set up with Shaw as the ISP.  so I

changed the ini file to SMTP = smtp.shaw.ca, is this right. How do I check

that outlook is set up on port 25, is it maybe on another port.  Below is

my script and ini settings any help would be greatly appreciated.

 

Jeremy

 

 

<html>

<body>

 

<?php

if (isset($_REQUEST['email']))

//if "email" is filled out, send email

  {

  //send email

  $email = $_REQUEST['email'] ;

  $subject = $_REQUEST['subject'] ;

  $message = $_REQUEST['message'] ;

  mail( "[email protected]", "Subject: $subject",

  $message, "From: $email" );

  echo "Thank you for using our mail form";

  }

else

//if "email" is not filled out, display the form

  {

  echo "<form method='post' action='email.php'>

  Email: <input name='email' type='text' /><br />

  Subject: <input name='subject' type='text' /><br />

  Message:<br />

  <textarea name='message' rows='15' cols='40'>

  </textarea><br />

  <input type='submit' />

  </form>";

  }

?>

 

</body>

</html>

 

 

Here are my php.ini settings

 

 

[mail function]

; For Win32 only.

SMTP = smtp.shaw.ca

smtp_port = 25

 

; For Win32 only.

sendmail_from = [email protected]

 

Link to comment
https://forums.phpfreaks.com/topic/163457-php-mail-function-i-know-another-one/
Share on other sites

It would probably help us if you told us what type of service you have from shaw and what you are trying to do (i.e. send mail from php running on your computer at your home...)

 

Here is their residential cable mail server lookup tool - http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Residential/Email/UsingEmail/SetUpMyEmailProgram.htm

 

You will probably need to use SMTP Authentication (i.e. make php look like a properly configured email client), in which case you will need to use one of the php mailer classes, because the php mail() function does not support SMTP Authentication.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.