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
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

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: 885
Joined: Tue Jan 10, 2006 6:20 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 0 guests