Setting up mail on MAMP on El Capitan

I’ve only recently switched over to Macs and have found setting up mail sending on the MAc’s MAMP as hard as Windows! So here’s how.

Firstly it all needs to be down in the “Terminal” – so click on Finder, then Applications, then Utilities to open a terminal (looks pretty similar to Windows CMD!)

Check a program called Postfix exists by typing

Postfix

That should give you the following errors – which for once is good news!
postfix: error: to submit mail, use the Postfix sendmail command
postfix: fatal: the postfix command is reserved for the superuser

Next we can start configuring for gmail – but first head over to you gmail account to set up using for less secure apps

In the terminal type or copy and paste
sudo vi /etc/postfix/main.cf

Than type your password and enter.
Scroll down and check the following lines exist…

mail_owner = _postfix
setgid_group = _postdrop

Editing took some googling for me as it is not intuitive! Here’s a cheatsheet
i) To delete – put the cursor over the character and press x
ii) To start inserting – place your cursor and press i, then start type or use copy (CTRL C) and paste (CTRL V).
To exit with out saving press key and then :q
To exit with saving press and then :wq

At the bottom of the file add the following

# Use Gmail SMTP
relayhost = smtp.gmail.com:587
smtp_sasl_mechanism_filter = plain
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom

You can change the relayhost to whatever server you like, I’m using gmail.
We need to create a gmail username/password file. So save and exit the main.cf file – , followed by :wq

Type
sudo vim /etc/postfix/smtp_sasl_passwd

and press i to start inserting again and add the following line

smtp.gmail.com:587 your_username@gmail.com:your_password

Save the file using :wq
Now we need to get it turned into what postfix wants by typing

sudo postmap /etc/postfix/smtp_sasl_passwd

Next we need to set it up for TLS

sudo vim /etc/postfix/smtp_tls_sites
Press i to start editing and add

[smtp_gmail.com]:587 MUST_NOPEERMATCH

Save :wq

And then type

sudo postmap /etc/postfix/smtp_tls_sites

And then sudo postfix start

Now we just need to test it all!
echo "Test sending email from Postfix" | mail -s "Test Postfix" youremail@domain.com

A quick php script to test from your MAMP server



Lastly to make these changes work for starting up your mac we need to do some more worrk, changing a file called /System/Library/LaunchDaemons/org.postfix.master.plist
which is read only because it is being used!

sudo launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist stops it!
Add the following before
RunAtLoad
KeepAlive

And then restart the daemon thingie…
sudo launchctl load /System/Library/LaunchDaemons/org.postfix.master.plist

Hope that helps you!

Emailing out Service Rotas

I’ve finally managed to fix and improve emailing out service rotas – the 2 bugs were simple to fix, but I wanted to add a message to the email too. Please update to v0.584 now for the improvement.

As ever do let me know via the support pages if you find a bug – I’d love the Church Admin plugin to serve your church well! If you do use it please consider a paypal donation -we would like to visit friends who are planting in China and your donation will help us go and be a blessing.

Bulk WordPress Password Reset

Reset by Orse on flikr.com
Reset by Orse on flikr.com
Sometimes it is a good idea to reset all the passwords for your WordPress website and email the users to let them know their new password. Especially when you have been hacked – if you have been hacked, read about what to do

My emergency password reset plugin will regenerate every user’s password and email it to them. If you have been hacked, I advise you change all the SALTS in wp-config.php, which forces all users to log out too. WordPress.org provides a tool to generate new SALTS.

To us my bulk emergency password reset and email plugin…

1) Download the emergency-password-reset at wordpress.org plugin
2) Upload the zip file to your plugins directory and activate.
3) If you are and administrator you can click on “Reset all Passwords” – the plugin will generate new more secure passwords and let all the users know.

Hope you find it useful