Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow safe_mode to be manually set in the Email Library #1531

Closed
wants to merge 2 commits into from

4 participants

@dixy

For example, on Infomaniak ini_get('safe_mode') returns false so the mail() function uses its fifth parameter (additional_parameters).
However Infomaniak does not allow this parameter. I have to set safe_mode to on manually to get mail function working.

@narfbg
Owner

What's Infomaniak and how does it not allow it? It doesn't allow the function argument at all or it doesn't specifically allow the -f parameter?

@dixy

Infomaniak seems to not allow the last argument of mail() (they have some restrictions to prevent spam).

See: http://expressionengine.com/archived_forums/viewreply/681593/

@jjaffeux

narfbg, infomaniak is an hosting provider : http://www.infomaniak.com/

@narfbg
Owner

I don't think that it's worth adding such stuff due to one hosting company's restrictive policies. But even if so, I don't think that changing the pseudo safe mode is the proper thing - other stuff may depend on it (now, or in the future). Something more tightly related to -f maybe?

@ckdarby

@narfbg I agree that this is an edge case; I would much rather see this pushed out to someone's MY_Email than to be pulled into CI.

@narfbg
Owner

It's been a while since we commented on this one ...

@dixy Have you figured another way around this?

@dixy

No, I just made a MY_Email class where I removed all references to safe_mode.

@narfbg
Owner

Okay then, closing this one. I don't think that -f has anything to do with safe mode anyway.

@narfbg narfbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 25, 2012
  1. @dixy
  2. @dixy

    Add to changelog

    dixy authored
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 5 deletions.
  1. +25 −5 system/libraries/Email.php
  2. +1 −0  user_guide_src/source/changelog.rst
View
30 system/libraries/Email.php
@@ -60,11 +60,11 @@ class CI_Email {
// even on the receiving end think they need to muck with CRLFs, so using "\n", while
// distasteful, is the only thing that seems to work for all environments.
public $dsn = FALSE; // Delivery Status Notification
- public $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
+ public $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
public $bcc_batch_mode = FALSE; // TRUE/FALSE - Turns on/off Bcc batch feature
public $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
+ public $safe_mode = FALSE; // TRUE/FALSE - Turns safe mode on/off
- protected $_safe_mode = FALSE;
protected $_subject = '';
protected $_body = '';
protected $_finalbody = '';
@@ -105,7 +105,7 @@ public function __construct($config = array())
else
{
$this->_smtp_auth = ! ($this->smtp_user === '' && $this->smtp_pass === '');
- $this->_safe_mode = (bool) @ini_get('safe_mode');
+ $this->set_safe_mode();
}
log_message('debug', 'Email Class Initialized');
@@ -140,7 +140,9 @@ public function initialize($config = array())
$this->clear();
$this->_smtp_auth = ! ($this->smtp_user === '' && $this->smtp_pass === '');
- $this->_safe_mode = (bool) @ini_get('safe_mode');
+
+ if ( ! isset($config['safe_mode']))
+ $this->set_safe_mode();
return $this;
}
@@ -550,6 +552,24 @@ public function set_crlf($crlf = "\n")
// --------------------------------------------------------------------
/**
+ * Set safe mode
+ *
+ * @param bool
+ * @return object
+ */
+ public function set_safe_mode($safe_mode = NULL)
+ {
+ if (is_null($safe_mode))
+ $this->safe_mode = (bool) @ini_get('safe_mode');
+ else
+ $this->safe_mode = (bool) $safe_mode;
+
+ return $this;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set Message Boundary
*
* @return void
@@ -1377,7 +1397,7 @@ protected function _spool_email()
*/
protected function _send_with_mail()
{
- if ($this->_safe_mode === TRUE)
+ if ($this->safe_mode === TRUE)
{
return mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str);
}
View
1  user_guide_src/source/changelog.rst
@@ -172,6 +172,7 @@ Release Date: Not Released
- Added support for setting custom attributes.
- Deprecated usage of the "anchor_class" setting (use the new "attributes" setting instead).
- Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments.
+ - Allow safe_mode to be manually set in the :doc:`Email Library <libraries/email>`.
- Core
Something went wrong with that request. Please try again.