Mailgun SMTP error

I am using the latest stable build now and I have managed to remove all errors from the log be it just one!

I am using Mailgun as a relay, I use it on all the sites including WP and it works without problems. But for some reason with OJS3 I get this error: [22-Jan-2023 12:41:29 UTC] SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub

Now this is what I have in my config, and I just want to check if this info is correctly or did I miss something?

; Use SMTP for sending mail instead of mail()
 smtp = On

; SMTP server settings
 smtp_server =
 smtp_port = 587

; Enable SMTP authentication
; Supported smtp_auth: ssl, tls (see PHPMailer SMTPSecure)
 smtp_auth = ssl
 smtp_username = journal@
 smtp_password = mypassword
; Supported smtp_authtype: RAM-MD5, LOGIN, PLAIN, XOAUTH2 (see PHPMailer AuthType)
; (Leave blank to try them in that order)
smtp_authtype =

; The following are required for smtp_authtype = XOAUTH2 (e.g. GMail OAuth)
; (See
; smtp_oauth_provider = Google
; smtp_oauth_email =
; smtp_oauth_clientid =
; smtp_oauth_clientsecret =
; smtp_oauth_refreshtoken =

Is there an API I can use for Mailgun as my host and network don’t really do well with SMTP due to security reasons.

Hi @Zarevac,

According to the Mailgun docs, it should be tls.

Sending via Mailgun API is not supported, but in the next release (3.4), it would be possible to create a simple plugin that does that.

Thank you. I changed it to tls but to no avail.
I think I should go for an API plugin. When is the release of the next version? And can I already use the beta?

While I don’t know the release date but I assume you can use the main branch to develop a plugin for 3.4. Emails are now sent using Laravel Mail API and Symphony Mailer. I foresee 3 steps:

  1. Install Mailgun transport as per link above to Laravel docs via composer from a plugin
  2. Add data to the mail config
  3. Add a form, e.g., in the plugin settings, to manage credentials

Regarding the second step, from a plugin you can use Config facade to set new values:

\Illuminate\Support\Facades\Config::set('mail.mailers.mailgun', [
    'domain' => '',
    'secret' => '',
    'endpoint' => ''

Don’t forget set it as a default one:

\Illuminate\Support\Facades\Config::set('mail.mailers.default', 'mailgun');

And for the third step, check the documentation for details:

Let me know if you have any questions

Thank you, I will create a sandbox and work on it. Once I am done I will make it available for everybody.

Hi @Zarevac,

I’ve created an example of the plugin: GitHub - Vitaliy-1/mailgun: An example of OJS 3 plugin to send emails via Mailgun API (for OJS 3.4).

1 Like

@Vitaliy Great, I will check it out. I was sidetracked by some projects at the faculty but I will dive into this :slight_smile:

Hi @Vitaliy ,

I am working on installing this plugin right now to see if I can get it working. I am having an issue with composer though, is there a workaround to install in manually?
Also, in the readme file you mention an endpoint?


You certainly can install packages listed in the composer.json manually but composer also deals with class autoload. If it’s the problem with the server, you can install composer locally, install dependencies and then upload plugin’s folder on the server.


1 Like

@Vitaliy I had to upgrade first the whole OJS script and I got the plugin to work after your last post. It works smooth, very nice! I also got composer fixed, it seemed that was less work then doing everything manually :slight_smile:

Thank you!

1 Like

This topic was automatically closed after 39 hours. New replies are no longer allowed.