Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP Mailer - SMTP Error

Posted on 2011-03-01
7
Medium Priority
?
968 Views
Last Modified: 2012-05-11
Hi I'm running a php mailer email. When there is an SMTP error the error message is breaking my layout.

SMTP Error: The following recipients failed: testtest@email.com

Is there anyway to hide this message when the email executes? I would rather move it into a session object that I can call in different sections of my php templates.
0
Comment
Question by:m2ew
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Enphyniti
ID: 35010422
Does it send any email, or do all addresses fail?

If I understand your question correctly, you are only trying to suppress the error returned when you use an invalid address.  Correct?
0
 

Author Comment

by:m2ew
ID: 35010440
Yes, It is sending an email. I want to turn if off on fail, and dump it into a session variable.
0
 
LVL 16

Expert Comment

by:Enphyniti
ID: 35010485
Assuming you are doing a mail($to, $subject... etc... I think you can just change it to:

@mail($to, $subject.. etc...

Otherwise if you want to do fancy error handling, you could do something like what is outlined here:  

http://stackoverflow.com/questions/4798498/disable-phpmailer-error-messages
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:m2ew
ID: 35010760
I tried the stack overflow method. The error output worked for putting the error info a new object that I can call in the template. However the SMTP error is still appearing.

Other than commenting it out of the PHPMailer class is there another way to disable?
0
 
LVL 16

Expert Comment

by:Enphyniti
ID: 35011340
You might try experimenting with ini_set() and try either of the following:

error_reporting(0)
or
display_errors(stderr)

More reading:
http://us.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
0
 

Author Comment

by:m2ew
ID: 35011562
From what I've tried it the display_errors won't block any fatal script errors, such as the SMTP recipient error that PHP Mailer is generating.

For now I'll create another instance and comment out the echo in PHP Mailer.
0
 
LVL 8

Accepted Solution

by:
rationalboss earned 600 total points
ID: 35013290
$p = new PHPMailer();
$p->MailerDebug = false;

or just edit phpmailer.inc.php and change MailerDebug's default value to false
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question