+function createReceiptHeaders($receipt) {
+
+ GLOBAL $data_dir, $username, $identity, $popuser, $domain;
+
+ $receipt_headers = Array();
+ if (isset($identity) && $identity != 'default') {
+ $from = getPref($data_dir, $username, 'full_name' . $identity);
+ $from_addr = getPref($data_dir, $username, 'email_address' . $identity);
+ } else {
+ $from = getPref($data_dir, $username, 'full_name');
+ $from_addr = getPref($data_dir, $username, 'email_address');
+ }
+ if ($from_addr == '') {
+ $from_addr = $popuser.'@'.$domain;
+ }
+
+ if ($from == '') {
+ $from = "<$from_addr>";
+ }
+ else {
+ $from = '"' . encodeHeader($from) . "\" <$from_addr>";
+ }
+
+ /* On Delivery */
+ if ( $receipt == 1
+ || $receipt == 3 ) {
+ $receipt_headers["Return-Receipt-To"] = $from;
+ }
+ /* On Read */
+ if ($receipt == 2
+ || $receipt == 3 ) {
+ /* Pegasus Mail */
+ $receipt_headers["X-Confirm-Reading-To"] = $from;
+ /* RFC 2298 */
+ $receipt_headers["Disposition-Notification-To"] = $from;
+ }
+ return $receipt_headers;
+}
+
+/* Figure out what the 'From:' address is
+ */
+
+function getFrom() {
+ global $username, $popuser, $domain, $data_dir, $identity;
+ if (isset($identity) && $identity != 'default') {
+ $from_addr = getPref($data_dir, $username,
+ 'email_address' . $identity);
+ }
+ else {
+ $from_addr = getPref($data_dir, $username, 'email_address');
+ }
+
+ if (!$from_addr) {
+ $from_addr = "$popuser@$domain";
+ }
+ return $from_addr;
+}
+
+