Sending mails from OJS 3.x


I’m trying to configure OJS to use principal contact email address in From: field but without success. From address is always user email address. I’m testing this by clicking “notify” button. My problem is SPF check, because we have many journals on one OJS installation with many editors using different mail addresses. This is my email config:

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

; SMTP server settings
smtp_server = localhost
smtp_port = 25

; Enable SMTP authentication
; Supported mechanisms: ssl, tls
; smtp_auth = ssl
; smtp_username = username
; smtp_password = password

; Allow envelope sender to be specified
; (may not be possible with some server configurations)
allow_envelope_sender = On

; Default envelope sender to use if none is specified elsewhere
; default_envelope_sender =

; Force the default envelope sender (if present)
; This is useful if setting up a site-wide noreply address
; The reply-to field will be set with the reply-to or from address.
; force_default_envelope_sender = Off

; Amount of time required between attempts to send non-editorial emails
; in seconds. This can be used to help prevent email relaying via OJS.
time_between_emails = 3600

; Maximum number of recipients that can be included in a single email
; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user
max_recipients = 10

; If enabled, email addresses must be validated before login is possible.
require_validation = Off

; Maximum number of days before an unvalidated account expires and is deleted
validation_timeout = 14



try using a real email account from your mail server with the default_envelope_sender setting and force_default_envelope_sender = On. Remove the semicolons from the front of course.

See a related discussion here: Option to use a global sender address for emails (to fight spamfilters?) · Issue #4014 · pkp/pkp-lib · GitHub

I tried setting default_envelope_sender but it’s the same - mail is always sent with a “From:” field set to user mail address. I would also like that Reply-to is in that case set to user mail address. I see that u did some changes in the code for this to work? Without proper reply-to setting default_envelope_sender would not have much sense when u have many journals hosted.

EDIT: now i see notice in saying:

Allow envelope sender to be specified
(may not be possible with some server configurations)
allow_envelope_sender = On

But there is no explanation what kind of configuration is that…


Can somebody help me with this? Having big problems with mail ending in junk folders or not delivered :frowning: So, i would like to configure OJS to send mail from just one address and reply-to field to be set to user mail address. Thx.


I made this plugin for our installation GitHub - ajnyga/useGlobalSender: When force_envelope_sender is enabled, replace all from fields with envelope_sender address

It checks if the force_envelope_sender is on and if the envelope_sender is address is given. If they exist, it will replace all from fields with the envelope_sender address.

Note that it requires the master branch version of pkp-lib/ at 63a4bda8a27ef8f21beb187ffc8b9ff8a2f06b0b · pkp/pkp-lib · GitHub


Thx. Does this mean that Reply-To field will be set to user mail address? I will try it and let you know the results.



The envelope sender will be what you define, the from field in the header will be something like “John Doe via Your Site Name” and the reply-to will be something like “John Doe”.


I have a problem with When i use this one that you linked i get Ajax error after clicking on “Notify” button in OJS. I use OJS


Ok, what version of OJS are you using?

I use OJS



any solution for this? thx.

hi sorry, I missed this. Did you check your php error log? If it seems to hard to debug the problem, I suggest that you wait for a OJS release where the issue is solved. There is an active pull request that would fix this, but not sure what the schedule is for that.


It seems there is nothing in error log because i get OJS page with a popup window saying “Failed Ajax request or invalid JSON returned” after i click on Notify. I will have to wait till this gets solved then. Hope it will be soon bcs. many users don’t get emails delivered to their mailboxes since sender_envelope is not working :frowning:



It seems i used wrong for testing, so now i got the proper one. However i’m not sure where to place your plugin? In plugins/generic directory? I don’t see it on plugin list page, is that normal? Thx.