summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class14
-rw-r--r--it_mail.class5
2 files changed, 11 insertions, 8 deletions
diff --git a/it.class b/it.class
index 1f39013..d28423d 100644
--- a/it.class
+++ b/it.class
@@ -772,17 +772,19 @@ static function map($expression, $array)
}
/**
- * Send a mail. Expects array for Header => Content pairs with Body => for the mail body.
+ * Send a mail.
+ * @param $p Header => Content pairs with Body => for the mail body
+ * @param $p['forcemail'] Send this mail even if we're on a twin or devel machine
* @return nothing useful
*/
static function mail($p)
{
- $body = $p['Body'];
- unset($p['Body']);
- $mail = new it_mail($p);
- $mail->add_body($body);
+ $headers = $p;
+ unset($headers['forcemail'], $headers['Body']);
+ $mail = new it_mail($headers);
+ $mail->add_body($p['Body']);
- return $mail->send();
+ return $mail->send($p);
}
/**
diff --git a/it_mail.class b/it_mail.class
index dafd704..81c9a67 100644
--- a/it_mail.class
+++ b/it_mail.class
@@ -179,9 +179,10 @@ function add_file($filename, $mimetype = "application/octet-stream", $name = '')
/**
* Send this email message
+ * @param $p['forcemail'] Send mail even if on twin or devel machine
* @return True if mail was accepted for delivery
*/
-function send()
+function send($p = array())
{
$to = join(",", $this->to);
$headers = array();
@@ -286,7 +287,7 @@ function send()
$text .= "--$boundary1--\n";
}
- if (it::is_live() || EDC('forcemail'))
+ if (it::is_live() || EDC('forcemail') || $p['forcemail'])
{
if (($result = mail($to, $this->header_escape($this->subject), $text, join("\n", $headers), $this->flags)) === false)
it::error(array('title' => "failed sending mail to $to subject $this->subject", 'body' => D($text, $headers, $this->flags)));