Skip to content

Commit 5e59282

Browse files
committed
removed DEFAULT values for TEXT columns in MySQL sendmailwrapper.messages table
fixes #5
1 parent 1a1a18b commit 5e59282

3 files changed

Lines changed: 10 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
## 1.0.3 (2019-10-14)
44

5-
- Fix for PHP setup where extensions are not compiled-in, loaded as modules. Standard php.ini is now loaded.
5+
- Fix for PHP setup where extensions are not compiled-in, loaded as modules. Standard php.ini is now loaded. fixes #1, #4
66
- Code style: replaced traditional syntax array literals
77
- Code smells: fixes various minor code smells
88
- Pushed minimum required PHP version to 7.2
99
- Improved array to object conversion in ConfigLoader by using json_encode/decode trick.
10+
- Removed DEFAULT values for TEXT columns in MySQL sendmailwrapper.messages table, fixes #5
1011

1112
## 1.0.2 (2015-11-04)
1213

app/SendmailThrottle.php

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -212,37 +212,14 @@ protected function _logMessage($throttleId, $username, $rcptCount, $status)
212212
$stmt->bindParam(':rcptCount' , $rcptCount);
213213
$stmt->bindParam(':status' , $status);
214214
$stmt->bindParam(':msgid' , $headerArr['x-meta-msgid']);
215-
$stmt->bindParam(':fromAddr' , $this->_mimeHeaderDecode($headerArr['from']));
216-
$stmt->bindParam(':toAddr' , $this->_mimeHeaderDecode($headerArr['to']));
217-
$stmt->bindParam(':ccAddr' , $this->_mimeHeaderDecode($headerArr['cc']));
218-
$stmt->bindParam(':bccAddr' , $this->_mimeHeaderDecode($headerArr['bcc']));
219-
$stmt->bindParam(':subject' , $this->_mimeHeaderDecode($headerArr['subject']));
215+
$stmt->bindParam(':fromAddr' , mb_decode_mimeheader($headerArr['from']));
216+
$stmt->bindParam(':toAddr' , mb_decode_mimeheader($headerArr['to']));
217+
$stmt->bindParam(':ccAddr' , mb_decode_mimeheader($headerArr['cc']));
218+
$stmt->bindParam(':bccAddr' , mb_decode_mimeheader($headerArr['bcc']));
219+
$stmt->bindParam(':subject' , mb_decode_mimeheader($headerArr['subject']));
220220
$stmt->bindParam(':site' , $headerArr['x-meta-site']);
221221
$stmt->bindParam(':client' , $headerArr['x-meta-client']);
222222
$stmt->bindParam(':script' , $headerArr['x-meta-script']);
223223
$stmt->execute();
224224
}
225-
226-
/**
227-
* Decode MIME header elements
228-
*
229-
* @param string $header
230-
* @return string
231-
*/
232-
protected function _mimeHeaderDecode($header)
233-
{
234-
return mb_decode_mimeheader($header);
235-
//return iconv_mime_decode($header, 0, 'UTF-8');
236-
237-
/*
238-
$utf8Header = imap_utf8($header);
239-
$decoded = imap_mime_header_decode($utf8Header);
240-
if (isset($decoded[0])) {
241-
$decodedObj = $decoded[0];
242-
return $decodedObj->text;
243-
} else {
244-
return $utf8Header;
245-
}
246-
*/
247-
}
248225
}

schema/schema.mysql.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ CREATE TABLE IF NOT EXISTS `sendmailwrapper`.`messages` (
4242
`status` INT NOT NULL DEFAULT 0 COMMENT 'throttle status code (exit code)',
4343
`msgid` VARCHAR(255) NULL COMMENT 'sendmail-wrapper message ID',
4444
`from_addr` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'from address',
45-
`to_addr` TEXT NOT NULL DEFAULT '' COMMENT 'to address(es)',
46-
`cc_addr` TEXT NOT NULL DEFAULT '' COMMENT 'Cc address(es)',
47-
`bcc_addr` TEXT NOT NULL DEFAULT '' COMMENT 'Bcc address(es)',
45+
`to_addr` TEXT NOT NULL COMMENT 'to address(es)',
46+
`cc_addr` TEXT NOT NULL COMMENT 'Cc address(es)',
47+
`bcc_addr` TEXT NOT NULL COMMENT 'Bcc address(es)',
4848
`subject` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'email subject',
4949
`site` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'site where this email was sent from',
5050
`client` VARCHAR(40) NULL COMMENT 'client IP that invoked the email generation',

0 commit comments

Comments
 (0)