Setting up emails with WordPress on Linux
-
Hi
I am getting quite frustrated with trying to setup my Google G Suite email with WordPress and my Linux server. I’ve spent a week solidly trying to get my head around how send emails from a Linux server hosting WordPress and I’m not getting anywhere. There are so many variables at play with the various applications I have installed on my Linux server, and the parameters each application has, I get one thing working but break something else! I’ve indulged so much information from online in it’s now becoming an impossible task as I can’t find out what I’m doing wrong. Once I get this working, I’m actually going to be making a guide myself and sharing it to the world because it’s ridiculous that I can find any official guides on this. I refuse to install the plugin
WP Mail SMTP by WPForms
when there should be an already implemented feature that can handle this.As a suggestion to the people who develop WordPress I would like to propose a way to set SMTP server settings in the setup stage, WordPress Dashboard and WP-Cli please.
I have public domain I purchased with Namescheap and I have an email with Google G Suite (now Google Workspace). I will refer to my public domain as
example.com
throughout this post. My Linux server has the FQDN ofubuntu-server.example.com
and my email is[email protected]
with an alias email;[email protected]
.My Apache and PHP processes are running under the Linux user and group
www-data
by default. Now sure if these should be different, so please advise if they should. When I go to change the Administration Email Address on the WordPress dashboard atSettings > General Settings > Administration Email Address
or submit a form with ContactForm7 on the site front-end, I can see in my mail log at/var/log/mail.log
the sender is always[email protected]
– the user the PHP process is running under on the operating system.All I know is that WordPress uses the
wp_mail()
function and relies on PHP to send mail, but through some thorough reading there is also something called PHPMailer and is included with WordPress. Is PHPMailer supposed to be able to send emails without a MTA (Mail Transfer Agent) like Sendmail or Postfix?I have followed numerous guides on how to use Postfix as a SMTP relay to Google and majority of them mention using address re-writing before sending it on through the relay. I have setup my Google G Suite Gmail to accept ‘Less Secure Apps’ and sent some test emails and Postfix seems to be working. The interesting thing is I have commented the entire mail section of
/etc/php/7.4/fpm/php.ini
so I am confused how WordPress is communicating with Postfix still. I assume there are some system hooks Apache has with PHP elsewhere?I partially got the address re-writing function working with Postfix to re-write everything that comes from the
[email protected]
to[email protected]
, but in the received email the name was showing asWordPress
. In some tests after playing with some Postfix settings I even received emails showing as[email protected]
.Can someone help me out here please as this all so confusing?
- The topic ‘Setting up emails with WordPress on Linux’ is closed to new replies.