Skip to content

Commit 59f6662

Browse files
committed
Added sender_host to messages table to report connected sendmail-wrapper host
preparing for 1.0.6 release
1 parent f29e308 commit 59f6662

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# CHANGELOG
22

3-
## 1.0.6 (UNRELEASED)
3+
## 1.0.6 (2020-07-24)
44

55
- Avoid PHP Notices on non-standard mail header lines that don't contain a column, reporting warning to syslog.
6+
- Add `sender_host` to `messages` table, reporting the connected sendmail-wrapper hostname, in case the MySQL database is located on a remote host and sendmail-wrapper is deployed to multiple hosts.
67

78
## 1.0.5 (2019-10-29)
89

app/SendmailThrottle.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ protected function _logMessage($throttleId, $username, $rcptCount, $status)
212212
$bcc = mb_decode_mimeheader($headerArr['bcc'] ?? null);
213213
$subject = mb_decode_mimeheader($headerArr['subject'] ?? null);
214214

215-
$sql = 'INSERT INTO messages (throttle_id, username, uid, gid, rcpt_count, status, msgid, from_addr, to_addr,
216-
cc_addr, bcc_addr, subject, site, client, script)
215+
$sql = "INSERT INTO messages (throttle_id, username, uid, gid, rcpt_count, status, msgid, from_addr, to_addr,
216+
cc_addr, bcc_addr, subject, site, client, sender_host, script)
217217
VALUES (:throttleId, :username, :uid, :gid, :rcptCount, :status, :msgid, :fromAddr, :toAddr,
218-
:ccAddr, :bccAddr, :subject, :site, :client, :script)';
218+
:ccAddr, :bccAddr, :subject, :site, :client, SUBSTRING_INDEX(USER(), '@', -1), :script)";
219219
$stmt = $this->_pdo->prepare($sql);
220220
$stmt->bindParam(':throttleId', $throttleId);
221221
$stmt->bindParam(':username' , $username);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- 2020-07-24
2+
ALTER TABLE `sendmailwrapper`.`messages` ADD `sender_host` VARCHAR(255) NOT NULL DEFAULT 'localhost' AFTER `client`;

schema/schema.mysql.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ CREATE TABLE IF NOT EXISTS `sendmailwrapper`.`messages` (
4949
`subject` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'email subject',
5050
`site` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'site where this email was sent from',
5151
`client` VARCHAR(40) NULL COMMENT 'client IP that invoked the email generation',
52+
`sender_host` VARCHAR(255) NOT NULL DEFAULT 'localhost',
5253
`script` VARCHAR(255) NULL COMMENT 'script that generated this email',
5354
PRIMARY KEY (`id`),
5455
INDEX `fk_messages_throttle_idx` (`throttle_id` ASC),

0 commit comments

Comments
 (0)