OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Different SMTP info for each journal

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Different SMTP info for each journal

Postby netfunda » Sun Aug 02, 2009 12:45 pm

I have many journals hosted on my server and I need different SMTP info for each journal.

As in default OJS I can use only one email address and related SMTP info:

Code: Select all
smtp = On
smtp_server = mail.domain.com
smtp_port = 25
smtp_auth = PLAIN
smtp_username = myuser@domain.com
smtp_password = xyz123abc


But I need something like:

Code: Select all
smtp = On
smtp_server_JOURNAL1 = mail.domain.com
smtp_port_JOURNAL1 = 25
smtp_auth_JOURNAL1 = PLAIN
smtp_username_JOURNAL1 = myuser@domain.com
smtp_password_JOURNAL1 = xyz123abc

smtp_server_JOURNAL2 = mail.domain.com
smtp_port_JOURNAL2 = 25
smtp_auth_JOURNAL2 = PLAIN
smtp_username_JOURNAL2 = myuser@domain.com
smtp_password_JOURNAL2 = xyz123abc


I understand I can use the above if I manage to modify: classes/mail/SMTPMailer.inc.php

Code: Select all
function SMTPMailer() {
      $this->server = Config::getVar('email', 'smtp_server');
      $this->port = Config::getVar('email', 'smtp_port');
      $this->auth = Config::getVar('email', 'smtp_auth');
      $this->username = Config::getVar('email', 'smtp_username');
      $this->password = Config::getVar('email', 'smtp_password');
      if (!$this->server)
         $this->server = 'localhost';
      if (!$this->port)
         $this->port = 25;
   }


Please help.
netfunda
 
Posts: 14
Joined: Tue Jul 28, 2009 8:42 am

Re: Different SMTP info for each journal

Postby crlsgms » Mon May 10, 2010 12:33 pm

For me it also could be really useful. how did you managed this code? is it working there 100% ?

is there an alternative?
crlsgms
 
Posts: 28
Joined: Wed Jul 22, 2009 12:50 pm
Location: Franca - sp, brazil

Re: Different SMTP info for each journal

Postby crlsgms » Tue May 21, 2013 7:04 am

Is it possible? Ho do separated journals could send with different emails to the users / avaliators?
crlsgms
 
Posts: 28
Joined: Wed Jul 22, 2009 12:50 pm
Location: Franca - sp, brazil

Re: Different SMTP info for each journal

Postby JasonNugent » Thu May 23, 2013 5:43 am

Hi netfunda,

If you needed this behaviour, you could modify the way config variables are fetched out of the config.inc.php file by doing something like this:

Code: Select all
$journal = $request->getJournal();
$this->server[$journal->getPath()] = Config::getVar('email', 'smtp_server[' . $journal->getPath() . ']');


And then store that information in your config.inc.php like this:

Code: Select all
smtp_server[JOURNALPATH] = mail.example.com


Where JOURNALPATH is the path component to your journal. This is untested code, but it should give you an idea.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 910
Joined: Tue Jan 10, 2006 6:20 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests