Skip to content

Commit 628f2a3

Browse files
committed
chore: allow passing smtpPort
1 parent 45fc6c5 commit 628f2a3

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

TODO.md

-5
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devmehq/email-validator-js",
3-
"version": "1.0.18",
3+
"version": "1.0.19",
44
"private": false,
55
"description": "Advanced Email Validation with DNS MX lookup and Mailbox Verification",
66
"keywords": [

release.sh

-14
This file was deleted.

src/smtp.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function isInvalidMailboxError(smtpReply: string): boolean {
2323
* @param {String} smtpReply A message from the SMTP server.
2424
* @return {Boolean} True if this is a multiline greet.
2525
*/
26-
function isMultilineGreet(smtpReply: string) {
26+
function isMultilineGreet(smtpReply: string): boolean {
2727
return smtpReply && /^(250|220)-/.test(smtpReply);
2828
}
2929

@@ -51,9 +51,9 @@ export async function verifyMailboxSMTP(params: verifyMailBoxSMTP): Promise<bool
5151
const ret = (result: boolean) => {
5252
if (resolved) return;
5353

54-
if (!socket.destroyed) {
55-
socket.write('QUIT\r\n');
56-
socket.end();
54+
if (!socket?.destroyed) {
55+
socket?.write('QUIT\r\n');
56+
socket?.end();
5757
}
5858

5959
clearTimeout(resTimeout);
@@ -64,8 +64,6 @@ export async function verifyMailboxSMTP(params: verifyMailBoxSMTP): Promise<bool
6464
const messages = [`HELO ${domain}`, `MAIL FROM: <${local}@${domain}>`, `RCPT TO: <${local}@${domain}>`];
6565

6666
socket.on('data', (data: string) => {
67-
data = data.toString();
68-
6967
log('Mailbox: got data', data);
7068

7169
if (isInvalidMailboxError(data)) return ret(false);

0 commit comments

Comments
 (0)