Class: SMTPClient

smtp.SMTPClient

SMTPClient is a minimal SMTP client for nuclei scripts.

Example

const smtp = require('nuclei/smtp');
const client = new smtp.Client();

Table of contents

Constructors

Methods

Constructors

constructor

new SMTPClient(): SMTPClient

Returns

SMTPClient

Defined in

smtp.ts:15

Methods

IsOpenRelay

IsOpenRelay(host, port, msg): boolean

IsOpenRelay checks if a host is an open relay.

Parameters

NameType
hoststring
portnumber
msgSMTPMessage

Returns

boolean

Example

const smtp = require('nuclei/smtp');
const message = new smtp.SMTPMessage();
message.From('xyz@projectdiscovery.io');
message.To('xyz2@projectdiscoveyr.io');
message.Subject('hello');
message.Body('hello');
const isRelay = smtp.IsOpenRelay('acme.com', 25, message);

Defined in

smtp.ts:43


IsSMTP

IsSMTP(host, port): IsSMTPResponse

IsSMTP checks if a host is running a SMTP server.

Parameters

NameType
hoststring
portnumber

Returns

IsSMTPResponse

Example

const smtp = require('nuclei/smtp');
const isSMTP = smtp.IsSMTP('acme.com', 25);
log(toJSON(isSMTP));

Defined in

smtp.ts:25


SendMail

SendMail(host, port, msg): boolean

SendMail sends an email using the SMTP protocol.

Parameters

NameType
hoststring
portstring
msgSMTPMessage

Returns

boolean

Example

const smtp = require('nuclei/smtp');
const message = new smtp.SMTPMessage();
message.From('xyz@projectdiscovery.io');
message.To('xyz2@projectdiscoveyr.io');
message.Subject('hello');
message.Body('hello');
const isSent = smtp.SendMail('acme.com', 25, message);

Defined in

smtp.ts:61