diff -u -r vacation_head/config/conf.xml vacation-h3-3.0_ch/config/conf.xml
--- vacation_head/config/conf.xml 2006-03-13 19:05:58.000000000 +0100
+++ vacation-h3-3.0_ch/config/conf.xml 2006-07-04 16:38:38.000000000 +0200
@@ -21,6 +21,8 @@
</configphp>
<configboolean name="subject" desc="Does your vacation setup support
configurable email subjects?">true</configboolean>
+ <configboolean name="from" desc="Does your vacation setup support
+ configurable email sender (from)?">true</configboolean>
</configsection>
<configsection name="server">
<configheader>Server configuration</configheader>
diff -u -r vacation_head/main.php vacation-h3-3.0_ch/main.php
--- vacation_head/main.php 2006-05-05 12:28:23.000000000 +0200
+++ vacation-h3-3.0_ch/main.php 2006-07-04 16:32:50.000000000 +0200
@@ -71,12 +71,16 @@
}
$vacationmsg = Util::getFormData('mess', false);
+ $vacationtxt = ''; // Initial value of new text
// Include the mail subject if the driver supports it.
if ($conf['vacation']['subject']) {
- $vacationtxt = 'Subject: ' . Util::getFormData('subject') . "\n" . $vacationmsg;
- } else {
- $vacationtxt = $vacationmsg;
+ $vacationtxt .= 'Subject: ' . Util::getFormData('subject') . "\n";
+ }
+ // Include the mail from if the driver supports it.
+ if ($conf['vacation']['from']) {
+ $vacationtxt .= 'From: ' . Util::getFormData('from') . "\n";
}
+ $vacationtxt .= $vacationmsg; // add the Message to the text
if (!$vacationmsg) {
$notification->push(_("You must give a vacation message."),
@@ -134,7 +138,6 @@
$curmessage = $conf['vacation']['default'];
}
-
// Split the vacation text in a subject and a message if the driver supports
// it.
if ($conf['vacation']['subject']) {
@@ -145,6 +148,21 @@
$cursubject = '';
}
}
+// Split the vacation text in a from and a message if the driver supports
+// it.
+if ($conf['vacation']['from']) {
+ if (preg_match('/^From: ([^\n]+)\n(.+)$/s', $curmessage, $matches)) {
+ $curfrom = $matches[1];
+ $curmessage = $matches[2];
+ } else {
+ // no sender? take the default identity
+ require_once 'Horde/Identity.php';
+ $identity = &Identity::singleton(array('imp', 'imp'));
+ $select_list = $identity->getSelectList();
+ $curfrom = $identity->_identities[$identity->_default]['fullname'] .
+ ' <'. $identity->_identities[$identity->_default]['from_addr'] .'>';
+ }
+}
$alias = Util::getFormData('alias');
if (is_null($alias)) {
diff -u -r vacation_head/templates/main/main.inc vacation-h3-3.0_ch/templates/main/main.inc
--- vacation_head/templates/main/main.inc 2006-04-23 09:29:35.000000000 +0200
+++ vacation-h3-3.0_ch/templates/main/main.inc 2006-07-04 16:35:49.000000000 +0200
@@ -60,6 +60,15 @@
</div>
<?php endif ?>
+<?php if ($GLOBALS['conf']['vacation']['from']): ?>
+<div>
+<br />
+<?php echo _("From:") ?>
+<br />
+<input name="from" type="text" size="70" value="<?php echo htmlspecialchars($curfrom) ?>" />
+</div>
+<?php endif ?>
+
<div>
<br />
<?php echo _("Message:") ?>