Using iCloud as SMTP Server for Transactional Emails

Latest version. Using the config.productions.json file, I have edited the email section to include my iCloud email settings.

I have also generated an app specific password and as the password for the email in the config file, I am using that app specific password. I have also tried using the actual password for my email and I have tried with 465 and 587 as the port. All without success as I, after ghost restart, cannot update the newsletter emails. The button goes red and says “x retry”.

Has anyone does this successfully and if so, what settings did you use?

I don’t have any experience with iCloud, but if you like to you can utilize mailhog which I highly recommend for development testing.

I’m using it for the website for our community, if you like to see an live example:

If this isn’t useful, then please disregard and good luck with your iCloud journey.

Thank you for this and thanks for taking the time to review / write. Appreciate it.

I’m trying to find / understand how to use the config file with the official SMTP iCloud settings and today, I’ll talk to Apple.

Hi thebear.dev,
Did you successfully managed to configure it ?
Because I’m facing the same problem.

Here is my config.production.json :

"mail": {
    "transport": "SMTP",
    "from": "'Something' <working_alias@icloud.com>",
    "options": {
        "host": "smtp.mail.me.com",
        "port": 587,
        "secure": true,
        "auth": {
            "user": "working_alias@icloud.com",
            "pass": "application_password_generated_on_apple_ID_portal"
        }
    }
}

As you can see, I’ve tried to adapt the syntax. For example, I’ve deleted the “service” line (maybe I should put it back, with “icloud” value ?).

Here is the error I get in the /ghost admin UI, when I try for example to invite someone to become a contributor :
An unexpected error occurred, please try again.

Here is the log of the Ghost container :

Error sending email: Failed to send email. Reason: Sending failed. Please check your email settings and resend the invitation.
[2022-09-03 10:30:18] WARN Error sending email: Failed to send email. Reason: Sending failed. Please check your email settings and resend the invitation.
[2022-09-03 10:30:18] ERROR "POST /ghost/api/admin/invites/" 500 668ms
"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error ID:
    68406f00-2b73-11ed-9d42-cd0251519a0c
----------------------------------------
Error: Sending failed
    at createMailError (/var/lib/ghost/versions/5.12.0/core/server/services/mail/GhostMailer.js:67:12)
    at DirectMailer.<anonymous> (/var/lib/ghost/versions/5.12.0/node_modules/nodemailer-direct-transport/lib/direct-transport.js:157:41)
    at DirectMailer.<anonymous> (/var/lib/ghost/versions/5.12.0/node_modules/nodemailer-direct-transport/lib/direct-transport.js:228:30)
    at DirectMailer.<anonymous> (/var/lib/ghost/versions/5.12.0/node_modules/nodemailer-direct-transport/lib/direct-transport.js:326:28)
    at Object.onceWrapper (node:events:628:26)
    at SMTPConnection.emit (node:events:513:28)
    at SMTPConnection._onError (/var/lib/ghost/versions/5.12.0/node_modules/smtp-connection/lib/smtp-connection.js:518:10)
    at SMTPConnection._actionGreeting (/var/lib/ghost/versions/5.12.0/node_modules/smtp-connection/lib/smtp-connection.js:893:14)
    at SMTPConnection._processResponse (/var/lib/ghost/versions/5.12.0/node_modules/smtp-connection/lib/smtp-connection.js:669:16)
    at SMTPConnection._onData (/var/lib/ghost/versions/5.12.0/node_modules/smtp-connection/lib/smtp-connection.js:493:10)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

I’m running a fresh install of Ghost 5.12.0 with MySQL 8.0

Thanks for anyone help about this.