OJS 2 Email (safe mode) problem

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

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.
pashton
Posts: 38
Joined: Fri Dec 17, 2004 5:51 pm
Contact:

OJS 2 Email (safe mode) problem

Postby pashton » Mon Jul 11, 2005 7:06 am

Hi

Whenever I try to use the email function function in the site it fails (that is when I try to send any email). The 'fifth parameter' seems to be poping up in a number of place. Any ideas of a solution if you can't change SAFE MODE. (This is probably linked to my last post)

Regards
Paul

Warning: mail(): SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE. in/home/cosmosan/public_html/classes/core/String.inc.php on line 155

Warning: Cannot modify header information - headers already sent by (output started at /home/cosmosan/public_html/classes/core/String.inc.php:155) in/home/cosmosan/public_html/classes/core/Request.inc.php on line 32

kevin
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm
Contact:

Postby kevin » Mon Jul 11, 2005 8:52 am

Assuming that mail is still getting send out, you could "fix" this by editing classes/core/String.inc.php and changing "return mail(...)" to "return @mail(...)". That would suppress the warning message.

The only functionality lost by not being able to pass the additional parameter is the ability to set the envelope sender in outgoing mail (useful for bounces).

pashton
Posts: 38
Joined: Fri Dec 17, 2004 5:51 pm
Contact:

emails not being sent

Postby pashton » Fri Jul 15, 2005 11:06 pm

Thanks Kevin,

Yes this has removed the error but the email itsef is not being sent. I have an operational version of 1.x and it sends emails o.k. so it is unlikely the server configuration.

Any ideas?

Regards
Paul

kevin
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm
Contact:

Postby kevin » Fri Jul 15, 2005 11:56 pm

Does removing the actual parameter from the mail() call work?

pashton
Posts: 38
Joined: Fri Dec 17, 2004 5:51 pm
Contact:

Postby pashton » Sat Jul 16, 2005 12:18 am

I am not sure exactly what you mean by this.

But if you mean

1) to remove the line 'return mail....' Then no it does not

or

2) to remove the contents of the () after the word mail then no it does not eiher

Sorry to be a bit vague.

Regards

Paul

kevin
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm
Contact:

Postby kevin » Sat Jul 16, 2005 12:26 am

I've tested this now and removing the last parameter does indeed do the trick.

The most appropriate fix seems to be something like:

Code: Select all

Index: classes/core/String.inc.php
===================================================================
RCS file: /cvs/ojs2/classes/core/String.inc.php,v
retrieving revision 1.3
diff -u -r1.3 String.inc.php
--- classes/core/String.inc.php 16 Jun 2005 20:28:05 -0000      1.3
+++ classes/core/String.inc.php 16 Jul 2005 07:24:13 -0000
@@ -151,8 +151,11 @@
        function mail($to, $subject, $message, $additional_headers = '', $additional_parameters = '') {
                // Cannot use mb_send_mail as it base64 encodes the whole body of the email,
                // making it useless for multipart emails
-
-               return mail($to, $subject, $message, $additional_headers, $additional_parameters);
+               if (empty($additional_parameters)) {
+                       return mail($to, $subject, $message, $additional_headers);
+               } else {
+                       return mail($to, $subject, $message, $additional_headers, $additional_parameters);
+               }
        }
 
        //


So this will work correctly in safe mode (so long as allow_envelope_sender is not enabled in config.inc.php) and also work correctly in non-safe mode.

pashton
Posts: 38
Joined: Fri Dec 17, 2004 5:51 pm
Contact:

Postby pashton » Sat Jul 16, 2005 1:04 am

Thanks again (again) Kevin,

That worked well.

Just one other thing that may or may not be related. The emails sent have the following code:

{$journalName}
{$indexUrl}/{$journalPath}

Is this a call to some data or are you supposed to edit step 1.4 of the journal setup to 'real' names.

Regards Paul

kevin
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm
Contact:

Postby kevin » Sat Jul 16, 2005 12:12 pm

Check the "Email Identification" field in Journal Setup step 1. Those variables should have been replaced with the real values when the journal was created.


Return to “OJS Editorial Support and Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests