Make WordPress Core

Opened 10 years ago

Closed 5 years ago

Last modified 5 years ago

#29069 closed enhancement (wontfix)

Proposal: wp-pluggable.php patch to send email through SMTP, not mail()

Reported by: janr's profile JanR Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Mail Keywords:
Focuses: Cc:

Description

Hereby I provide you with a patch to WordPress 3.9.1's wp-includes/pluggable.php file, to enable the use of SMTP as email option. This patch provides several advantages:

  • it allows website owners to send email thought their ISP's SMTP server, instead of using the mail() function and localhost.
  • TLS and SSL encrypted connections are supported, as are alternative SMTP ports

And all this makes it even possible to mail though Gmail's SMTP server.

I dediced to put the email configuration in wp-config.php, so there is a patch for that file too.

The story beind the patches is: I found it kinda strange the WordPress core lacks this functionality out-of-the-box, now more and more hosting providers require to use SMTP and TLS for sending mail from websites. Not to mention beter privacy protection due to the SMTP pipe being encrypted. The in WordPress included PHPMailer version supports these options by default.

The patches are open for improvement.

Regards,

Jan,

Attachments (2)

pluggable.php.patch (1.1 KB) - added by JanR 10 years ago.
patches on wp-includes/pluggable.php and wp-config.php
29069.diff (1.4 KB) - added by michalzuber 10 years ago.

Download all attachments as: .zip

Change History (22)

@JanR
10 years ago

patches on wp-includes/pluggable.php and wp-config.php

#1 @inetbizo
10 years ago

  • Keywords needs-docs needs-codex needs-unit-tests reporter-feedback added
  • Severity changed from normal to trivial
  • Version set to 3.9.1

This would work well with OpenPGP & Commercial CA signed / encrypted body

#2 @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback removed
  • Severity changed from trivial to normal
  • Summary changed from Propasal: wp-pluggable.php patch to send email through SMTP, not mail() to Proposal: wp-pluggable.php patch to send email through SMTP, not mail()

@michalzuber
10 years ago

#3 @michalzuber
10 years ago

Nice one. I think there is no need for addReplyTo also From and FromName are already set above in the code.
Added constants into wp-config-sample.php
Using SMTP is good on shared hosts, more flexible to avoid hosts mail server been blacklisted.

#4 follow-ups: @SergeyBiryukov
10 years ago

wp_mail() is a pluggable function, so these constants won't work if it's replaced by a plugin.

This sounds like plugin territory, and there are plugins for sending emails via SMTP.

#5 in reply to: ↑ 4 @JanR
10 years ago

Replying to SergeyBiryukov:

wp_mail() is a pluggable function, so these constants won't work if it's replaced by a plugin.

This sounds like plugin territory, and there are plugins for sending emails via SMTP.

Not to start a discussion, but the whole point is to remove the need for a plugin. In my opinion, this is such a basic task that should be available in WP's core.

#6 @michalzuber
10 years ago

  • Keywords 2nd-opinion added

I like the idea, but hard to decide what should and shouldn't be part of WP. With this SMTP setting I more inclined to it should be without a need of a plugin. I don't know how many people use for example Email posting (download from POP3 mailbox) and is part of WP, but these SMTP settings would fit into WP Settings->Writing admin page. Other plugins could also use it and the user has to change in one place.
An article why is SMTP better than mail() http://www.jvfconsulting.com/blog/190/PHP_Mail_Function_vs_SMTP_Guaranteed_Delivery.html
In my opinion WP is about quality and it should have this builtin option to better deliver emails.

#7 @JanR
10 years ago

Any news on this?

#8 in reply to: ↑ 4 ; follow-up: @chriscct7
9 years ago

Replying to SergeyBiryukov:

wp_mail() is a pluggable function, so these constants won't work if it's replaced by a plugin.

This sounds like plugin territory, and there are plugins for sending emails via SMTP.

True, but in the case a plugin replaces the function, then it will continue operating as it did before this change, and the constants will simply do nothing.

#9 in reply to: ↑ 8 @SergeyBiryukov
9 years ago

Replying to chriscct7:

True, but in the case a plugin replaces the function, then it will continue operating as it did before this change, and the constants will simply do nothing.

That's the problem, it would be confusing and hard to debug if you don't know where to look.

Still seems like plugin territory to me.

#10 @dd32
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

I'm going to close this as maybelater.
My reasons are as follows

  • WordPress follows the Decisions, Not Options philosophy. WordPress users shouldn't be given options which they don't actually need.
  • Mail sending should just work for users, if it doesn't work with mail() the PHP settings are probably wrong on the host, and something should be done there.
  • Plugins fill the need very well, as shown by the number of plugins and usage figures of them. I am however surprised by the amount of sites utilising SMTP plugins, but I'm not sure all of them actually need them.

In the event that we decide to add native SMTP settings into WordPress, a committer can re-open this. Discussion can also continue while the ticket is closed.

#11 @ocean90
8 years ago

#39465 was marked as a duplicate.

This ticket was mentioned in Slack in #core-multisite by desrosj. View the logs.


7 years ago

#13 @johnbillion
7 years ago

#41344 was marked as a duplicate.

#14 @SergeyBiryukov
6 years ago

#47206 was marked as a duplicate.

#15 @subwebsites
6 years ago

How many years do we need to wait for it to happen:
https://www.youtube.com/watch?v=KliSG4bH0mA

#16 @knutsp
6 years ago

#47206 was marked as a duplicate.

#17 @subwebsites
6 years ago

  • Resolution maybelater deleted
  • Status changed from closed to reopened

Ok, if this is the place I'm to post it then here it is, something needs to get done


How many years do we need to wait for this to happen... http://prntscr.com/nmmq92

https://www.youtube.com/watch?v=KliSG4bH0mA

The other threads never seem to resolve anything, it's like no-one cares

Unless there Police officers here saying this is closed without resolve then we are all in trouble for wanting something better.!!!

#18 @johnbillion
6 years ago

  • Keywords close added; needs-docs needs-codex needs-unit-tests 2nd-opinion removed
  • Version 3.9.1 deleted

This ticket has had no traction in five years because the discussion is resolved. Comments 9 and 10 are from WordPress core committers explaining why this functionality is best suited to plugins.

#19 @andraganescu
5 years ago

  • Resolution set to wontfix
  • Status changed from reopened to closed

There is nothing to do here, except continue a thread where the idea of having SMTP sending as an option clashes with the core philosophy of WordPress.

It is not that there is anything wrong with using SMTP and the occasional frustration with using mail() is understandable. However, it is not a large majority of WordPress use cases that requires such core functionality, especially since there are serious and tested plugin options.

@subwebsites adding SMTP support in core is not a solution to PHP's mail() function not working and it is also not a solution for optimised email sending or inbox targeting; these issues are to be addressed by hosts or server configuration.

I will close this again and please before reopening consider providing good arguments against comment 10 above.

#20 @andraganescu
5 years ago

  • Keywords close removed
Note: See TracTickets for help on using tickets.