Email problem

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
tonygis
Forum Newbie
Posts: 1
Joined: Thu Nov 06, 2008 3:20 pm

Email problem

Post 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.
sirish
Forum Newbie
Posts: 8
Joined: Tue Sep 09, 2008 11:45 pm

Re: Email problem

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Email problem

Post by pickle »

It sounds simply like the SMTP server isn't running at the URL you're trying.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Email problem

Post 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:
Post Reply