Jump to content

verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()


jihmantiquilla

Recommended Posts

gud day,

 

i am working into a send mail function in php, but it seems its not working due to these errors:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.bizmail.yahoo.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Documents and Settings\Ivan\Application Data\NuSphere\PhpED\projects\project2\Email.php on line 77

 

i do have use init_set to change my smtp server.

 

what are the other things that i need to do in order to sucesfully send an email..

comments and suggestion is much appreciated.

Is this on a local testing machine? its not likely you'll be able to connect to a remote smtp server if it is, not using the standard mail function anyway. Smtp servers generally require authentication, this is not something that is provided via php's mail function.

 

You could look into third party scripts such as PHPMailer or Zend_Mail.

u try this code

    <?php
    require_once "Mail.php";

    $from = "Chaitu <[email protected]>";
    $to = "Chaitu <[email protected]>";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";

    $host = "ssl://mail.example.com";
    $port = "465";
    $username = "smtp_username";
    $password = "smtp_password";

    $headers = array ('From' => $from,
      'To' => $to,
      'Subject' => $subject);
    $smtp = Mail::factory('smtp',
      array ('host' => $host,
        'port' => $port,
        'auth' => true,
        'username' => $username,
        'password' => $password));

    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
      echo("<p>" . $mail->getMessage() . "</p>");
     } else {
      echo("<p>Message successfully sent!</p>");
     }
    ?>

 

and change the hostname,port,username and password..provided u have PEAR installed in the machine

how would i integrate the PEAR or the PHPMailer into the Nusphere???

 

I'm not sure I understand what they have to do with your IDE? You just need to place them on your include_path to use them.

 

Some IDE's (I'm not a nusphere user) will also have a setting somewhere allowing you to add third party libs to the IDE's include_path, this will usually give you access to code hinting. No idea where this is (or if it is) in nusphere though.

iam using Nusphere as an ide which has a local webserver. how would i integrate the PEAR or the PHPMailer into the Nusphere???

 

could not able to get what to do it with the nusphere.

:wtf: is the nusphere...

just went through their site..

 

 

u can check whether u have pear installed in ur machine, just navigate to the php folder and there u will find one folder called as PEAR.

if it there u can use the code below.

or else if to check installed or not

use phpinfo and see for this value

PHP_PEAR_SYSCONF_DIR

iam using Nusphere as an ide which has a local webserver. how would i integrate the PEAR or the PHPMailer into the Nusphere???

 

could not able to get what to do it with the nusphere.

:wtf: is the nusphere...

just went through their site..

 

 

u can check whether u have pear installed in ur machine, just navigate to the php folder and there u will find one folder called as PEAR.

if it there u can use the code below.

or else if to check installed or not

use phpinfo and see for this value

PHP_PEAR_SYSCONF_DIR

 

All those directions are windows only by the way.

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.