PHP mail() vs SMTP

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Anti-Spam Guide
Post Reply
User avatar
open-your-eyes
Registered User
Posts: 71
Joined: Mon Jul 31, 2017 8:20 am

PHP mail() vs SMTP

Post by open-your-eyes »

Wich one is better? Wich do you recomand?
What's the difference?
Me, myself and I
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52139
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: PHP mail() vs SMTP

Post by Brf »

Use whichever one works for your board.
User avatar
Lumpy Burgertushie
Registered User
Posts: 68181
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: PHP mail() vs SMTP

Post by Lumpy Burgertushie »

most hosts provide both. some will turn off the php mail service because they mistakenly think it is a security risk.

as far as which one is better, like BRF said, use whichever one you like or whichever your host provides for you.

if you can't get your host to figure out how to use their own smtp system then you will need to use something like
gmail etc.

personally I have never had a problem with any host I have used when setting up emails using either the built in php mail function or the smtp function.

luck,
robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
Dog Cow
Registered User
Posts: 2500
Joined: Fri Jan 28, 2005 12:14 am
Contact:

Re: PHP mail() vs SMTP

Post by Dog Cow »

open-your-eyes wrote:
Mon Oct 12, 2020 5:19 pm
Wich one is better? Wich do you recomand?
What's the difference?
Both methods use SMTP because that's how emails are sent on the Internet.

The difference is that when you choose to use the PHP mail() function, you may be limited to a SMTP server defined in the php.ini configuration file, and there may be some additional email header lines that are added to the emails that will be sent (example: the file name and line number of the PHP script that called mail() ). The mail() function is also not very efficient for large volumes of email (like your site's Mass Email feature) at once because it repeatedly opens and closes the SMTP connection, which is additional overhead.

When you choose the direct SMTP option, your phpBB site connects directly to any SMTP server that you specify in the phpBB Admin configuration, and using a username and password that you supply. Therefore you may not have some additional header lines inserted by PHP when it sends email.

I recommend this option of direct SMTP because it give you the phpBB administrator some more control over how your emails are sent.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookMac GUIMac 512K Blog
Post Reply

Return to “phpBB Discussion”