jihmantiquilla Posted December 22, 2009 Share Posted December 22, 2009 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. Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/ Share on other sites More sharing options...
trq Posted December 22, 2009 Share Posted December 22, 2009 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. Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/#findComment-982029 Share on other sites More sharing options...
Deoctor Posted December 22, 2009 Share Posted December 22, 2009 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 Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/#findComment-982069 Share on other sites More sharing options...
jihmantiquilla Posted December 22, 2009 Author Share Posted December 22, 2009 iam using Nusphere as an ide which has a local webserver. how would i integrate the PEAR or the PHPMailer into the Nusphere??? Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/#findComment-982107 Share on other sites More sharing options...
trq Posted December 22, 2009 Share Posted December 22, 2009 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. Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/#findComment-982110 Share on other sites More sharing options...
Deoctor Posted December 22, 2009 Share Posted December 22, 2009 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. 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 Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/#findComment-982121 Share on other sites More sharing options...
trq Posted December 22, 2009 Share Posted December 22, 2009 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. 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. Link to comment https://forums.phpfreaks.com/topic/185968-verify-your-smtp-and-smtp_port-setting-in-phpini-or-use-ini_set/#findComment-982144 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.