Can't change "from" address ghost uses after setting up mailgun


#1

In production.config.json changing “from” parameter in mail block still has test email sent through ghost http admin interface as ghost@hostname. I’m using mailgun as ghost’s email setup and I also have webmail setup on zoho.com for denimandleather@denimandleather.me. I have SPF and DKIM setup as TXT records for BOTH zoho and mailgun.

"from": "'Denim And Leather' <denimandleather@denimandleather.me>",

Looks correct. But still getting error after restarting ghost and restarting the server.


#2

Hello,

In your production.config.json file, have you got a configuration like this:

"mail": {
    "from": "'Custom Name' <myemail@address.com>",
    "transport": "SMTP",
    "options": {
        "service": "Mailgun",
        "auth": {
            "user": "postmaster@example.mailgun.org",
            "pass": "1234567890"
        }
    }
}

I don’t know if needed but some informations are written here:
https://docs.ghost.org/docs/mail-config

In add, if your problem doesn’t fixed, could you show more “error” informations?


#3

I don’t see any error messages when I send a test email.

I had “from” inside of “options”: {} instead of “mail”: {}.

But I fixed it but the email is still sent from ghost@hostname. Could it have something to do with the way I have set up SPF and DKIM which is meant to prevent email phishing? The email is sent via mailgun to my email address which is served by 3rd party webmail zoho.com. I don’t have any email server setup on my own VPS.

"mail": {
    "from": "'Denim And Leather' <denimandleather@denimandleather.me>",
    "transport": "SMTP",
    "options": {
        "service": "Mailgun",
        "auth": {
            "user": "postmaster@example.mailgun.org",
            "pass": "1234567890"
        }
    }
}

#4

I had similiar issues setting up my production instance to work with mailgun. I think nodemailer might have an issue with the single quotes in the from field. I did some research back then and if I remember correctly, the single quotes aren’t explicitly necessary. After I got rid of the single quotes it started working. Here’s the mail portion of the config used by the instance (the sender works properly):

"mail": {
    "transport": "SMTP",
    "from": "My Ghost Robot <ghost-prod@domain.me>",
    "options": {
      "service": "mailgun",
      "auth": {
        "user": "ghost-prod@domain.me",
        "pass": "teehee"
      }
    }
  },

With regards to SPF / DKIM, Dmarcian is a well known service which provides inspection of DMARC (it’s a txt record that you add to your domain which configures reporting for DKIM + SPF), and it looks like mailgun isn’t permitted to send (it only allows zoho) via your spf records. You can run your check here. I don’t know what selector you chose for dkim, so I can’t verify it’s setup properly.

You’re sending the test email using the labs page in the admin interface, correct?


#5

I’m sending the test email using the labs page. I now setup SPF and DKIM on my domain records for denimandleather.me for mailgun.

I used the config.production.json setup you posted there without single quotes, but now I get this when I try to access my blog:

# 502 Bad Gateway

nginx/1.10.3 (Ubuntu)

#6

Start by checking folder permissions and nginx file setup in /etc/nginx/sites-available and make sure that you have the same file or a soft link in sites-enabled


#7

Bad gateway means ghost didn’t start. Can you paste your config in a JSON validator service (like JSONLint) and make sure there aren’t any errors? The mail {} shouldn’t be the only thing in your config file


#8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.