PHPMailer

Dear experts,

I wish to know the difference between Mail(), IsSMTP(), and IsSendMail() function from a php library called PHPMailer.

When should I use what function and which will be a better choice if I use a online web hosting plan as in shared hosting instead of dedicated host. Thanks

I've encountered an issue which I called a function Send() but the program didn't send out an email.

If i use SMTPDebug, will it shows me the possible errors?
Kinderly WadeprogrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
Even if you use SMTP , you need to be enabled the SMTP account on the hosting package.

Otherwise, you can use google (gmail) smtp details to send email from your hosting.  

ref. http://phpmailer.worxware.com/?pg=examplebgmail

It has example of gmail smtp with error display details.
0
Loganathan NatarajanLAMP DeveloperCommented:
If i use SMTPDebug, will it shows me the possible errors?

Open in new window


 $mail->ErrorInfo;   this will list out the possible errors on SMTP related.

like,
SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
SMTP Error: Could not connect to SMTP host.
0
Marcus BointonCommented:
Please don't link to obsolete docs - PHPMailer moved to Github ages ago.

The differences are:

isMail(): sends using PHP's built-in mail() function, which usually means it will call your local sendmail binary internally, as determined by your php.ini settings. You need to have a local mail server for this to work.

isSendmail(): send by calling your local sendmail binary directly via popen() - this can be slightly faster, and also give you a little more control if you're using a non-standard sendmail (e.g. like qmail's emulation). You need to have a local mail server for this to work.

isQmail(): the same as this but changes the default path to qmail's qmail-inject binary, and alters the command line params to be compatible with qmuil.

isSMTP(): sends using SMTP directly to a specific server. This uses the bundled SMTP PHP class. The advantage of this is that you gain fine control over the SMTP conversation, detailed feedback on delivery, and you can send from servers that do not have a local mail server installed (e.g. most Winfows servers). Its main disadvantages are that it can be slow (SMTP is not good for interactive use (e.g. during a page submission)), and it's not a complete MTA and does not handle queuing, bounces, retries etc.

SMTPDebug shows debug information about and during the SMTP conversation and complete session transcript. It accepts values between 0 and 4, where 0 is no debug info and 4 is the most.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Kinderly WadeprogrammerAuthor Commented:
Thanks Squinky. You just answered my question right on the spot.
0
Ray PaseurCommented:
I expect you're at the threshold of a journey that will be filled with darkness, anguish and frustration.  Email is one of those things that seems like it should be so easy... Until you try to make the email system work in a secure, predictable and sensible manner.  Then you find that it's full of bad design, hopeless incompatibilities, competing ISPs, spam, viruses, phishing, bizarre data losses, stolen identities, fraudulent messages, and a complete lack of accountability.  Your journey will include many angry phone calls saying, "I didn't get the email!" and "Why am I getting this email?" and "Why did he get the email before I did?"  When you find (as we all do) that your time spent wrestling with your automated email is a real drag on your life, you'll wish for an alternative.  

In 2008, I shut down all the automated email systems I had written (thousands of clients) and turned to ConstantContact.com.  I recommend that you use Constant Contact instead of trying to use an automated PHP library that you don't understand.  CC are efficient, effective and embarrassingly inexpensive, when compared to the time and cost that you're facing by trying to do all of this yourself.

There are competing services, for example Mail Chimp, and the like, but CC was the most professional and there was essentially no difference in cost.  They offer a free trial and can have you up and running within a few minutes.  Most importantly, they are consummate professionals who truly understand the email system and who spend 100% of their professional life getting email right.  When I first experienced their service I was reminded of the famous quote from the firefighter Red Adair: "If you think it's expensive to hire a professional, just wait till you hire an amateur!"

Firing myself and hiring Constant Contact is a decision I have never regretted.  Best of luck with your project, ~Ray
0
Kinderly WadeprogrammerAuthor Commented:
Hi Ray,

Thanks for suggesting alternative method. Yes I did get complaints of customer not receiving the emails.... The actual reason why that something I can't answer but I believe it is probably categorized as spam or somehow the client email filtered out the email (very very hard to predict).

I will definitely give ConstantContact.com a try. Thanks again Ray.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.