summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2011-11-22 16:39:06 +0000
committerUrban Müller2011-11-22 16:39:06 +0000
commit6f0cd1a4a442f9c27dd07f0e956f5253f378465d (patch)
tree2abc47b5d3024da58d908744cb3dad275eb67c4b
parent326f0dad5c9bebe408595a453d92194cd4eb932e (diff)
downloaditools-6f0cd1a4a442f9c27dd07f0e956f5253f378465d.tar.gz
itools-6f0cd1a4a442f9c27dd07f0e956f5253f378465d.tar.bz2
itools-6f0cd1a4a442f9c27dd07f0e956f5253f378465d.zip
support sending of mails on twin/devel
-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)));