Jump to content

ini_set problem in drupal


Nandini

Recommended Posts

Hi i am sending a mail by using gmail with phpmailer in Drupal. If internet is up the mail sending seccessfully. If internet is down i got a error like

 

"warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /usr/local/mysite/manager/wwwroot/includes/class.smtp.php on line 105.

 

warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Unknown error) in /usr/local/mysite/manager/wwwroot".

 

But I dont wan to display these errors when internet is off  (i am sending this email in localhost. So no need to internet to send mails). For this i user ini_set('display_errors', 0) in my mail send function. But the errors are still coming. Here is my script.

 

function user_mail_wrapper($MailID,$subject, $message)

{

        ini_set('display_errors',0);

        $Subject  ='<html>';

        $Subject  .=" <b><font color='#a10036'> Thank you for register </font></b><br><br>";

        $Subject .="<b> <font color ='#a10036'>Thanks&Regards</font></b><br>";

        $Subject .="<b> <font color ='#a10036'>Administrator</font></b><br>";

        $MailID=$mail1;

        $mailer = new PHPMailer();

        $mailer->Mailer = "smtp";

        $mailer->IsSMTP();

        $mailer->Host = 'ssl://smtp.gmail.com:465';

        $mailer->SMTPAuth = TRUE;

        $mailer->Username =''my gmail id'';

        $mailer->Password =''my gmailid password'';

        $mailer->From =''[email protected]'';

        $mailer->FromName = "Administrator";

        $mailer->Body = ''.$Subject.'';

        $mailer->Subject = 'Register Invoice';

        $mailer->IsHTML(true);

        $mailer->AddAddress(''.$MailID.'');      // This is where you put the email adress of the person you want to mail

 

        if(!$mailer->Send())

        {

                drupal_set_message(t('Message was not sent'), 'error');

        }

        else

        {

                drupal_set_message("message has been sent");

        }

 

}

 

here i am calling the function

 

user_mail_wrapper($MailID,$subject, $message);

 

Can anyone help me out.

 

Thanq

 

 

Link to comment
https://forums.phpfreaks.com/topic/124780-ini_set-problem-in-drupal/
Share on other sites

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.