Page 1 of 1

Email problem

Posted: Thu Nov 06, 2008 3:32 pm
by tonygis
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi folks - first, I apologize if in wrong subject category.

My problem. Simple feedback form using php to email completed form notification to myself.

My error: "PHP Warning: mail(): Failed to connect to mailserver at "smtp.yourisp.net"

My system:

Windows
Apache 2.2.0
PHP 5.1.2


feedback php:

Code: Select all

 
<?php
require("class.phpmailer.php");
 
$msg = "Name:t$namen";
$msg .= "Email:t$emailn";
$msg .= "Comments:t$commentsn";
$recipient = "myemail@mydomain.org";
$subject = "New Feedback from my site";
$mailheaders = "From:$emailn";
$mailheaders .= "Reply-To:$emailnn";
mail($recipient, $subject, $msg, $mailheaders);
header("Location: http://mywebsite/feedback/thankyou.html");
?> 
 
Class PHPmailer snippet:

Code: Select all

 
 /////////////////////////////////////////////////
  // PROPERTIES FOR SMTP
  /////////////////////////////////////////////////
 
  /**
   * Sets the SMTP hosts.  All hosts must be separated by a
   * semicolon.  You can also specify a different port
   * for each host by using this format: [hostname:port]
   * (e.g. "smtp1.example.com:25;smtp2.example.com").
   * Hosts will be tried in order.
   * @var string
   */
  public $Host        = 'my_isp.net';
 
  /**
   * Sets the default SMTP server port.
   * @var int
   */
  public $Port        = 25;
 
  /**
   * Sets the SMTP HELO of the message (Default is $Hostname).
   * @var string
   */
  public $Helo        = '';
 
  /**
   * Sets connection prefix.
   * Options are "", "ssl" or "tls"
   * @var string
   */
  public $SMTPSecure = "";
 
  /**
   * Sets SMTP authentication. Utilizes the Username and Password variables.
   * @var bool
   */
  public $SMTPAuth     = true;
 
  /**
   * Sets SMTP username.
   * @var string
   */
  public $Username     = 'myemail@charter.net';
 
  /**
   * Sets SMTP password.
   * @var string
   */
  public $Password     = 'mypassword';
 
  /**
   * Sets the SMTP server timeout in seconds. This function will not
   * work with the win32 version.
   * @var int
   */
  public $Timeout      = 10;
 
  /**
   * Sets SMTP class debugging on or off.
   * @var bool
   */
  public $SMTPDebug    = false;
 
  /**
   * Prevents the SMTP connection from being closed after each mail
   * sending.  If this is set to true then to close the connection
   * requires an explicit call to SmtpClose().
   * @var bool
   */
  public $SMTPKeepAlive = false;
 
  /**
   * Provides the ability to have the TO field process individual
   * emails, instead of sending to entire TO addresses
   * @var bool
   */
  public $SingleTo = false;
 
My php.ini:

[mail function]
; For Win32 only.
SMTP = my.isp.net
smtp_port = 25

; For Win32 only.
sendmail_from = myemail@charter.net

I'm at my wits end here if someone could provide some guidance or simply point me in the right direction.

Best regards.


~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: Email problem

Posted: Thu Nov 06, 2008 11:30 pm
by sirish
maybe smtp server is not installed in my.isp.net server or your ip may be restricted for using the smtp server installed in my.isp.net. You can try the following
1)Download qk smtp server and install it in your computer
2)change smtp of php.ini to localhost
Then u can figure out why it is not working for the my.isp.net
:D

Re: Email problem

Posted: Fri Nov 07, 2008 10:47 am
by pickle
It sounds simply like the SMTP server isn't running at the URL you're trying.

Re: Email problem

Posted: Fri Nov 07, 2008 2:30 pm
by JAB Creations
Hi folks - first, I apologize if in wrong subject category.
It took you more time to type that then it would have to look at the forum index. :evil: