Class: Client

smtp.Client

Client is a minimal SMTP client for nuclei scripts.

Example

const smtp = require('nuclei/smtp');
const client = new smtp.Client('acme.com', 25);

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Client(host, port): Client

Parameters

NameType
hoststring
portstring

Returns

Client

Defined in

smtp.ts:15

Properties

host

host: string

Defined in

smtp.ts:15


port

port: string

Defined in

smtp.ts:15

Methods

IsOpenRelay

IsOpenRelay(msg): boolean

IsOpenRelay checks if a host is an open relay.

Parameters

NameType
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 client = new smtp.Client('acme.com', 25);
const isRelay = client.IsOpenRelay(message);

Defined in

smtp.ts:47


IsSMTP

IsSMTP(): SMTPResponse

IsSMTP checks if a host is running a SMTP server.

Returns

SMTPResponse

Example

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

Defined in

smtp.ts:28


SendMail

SendMail(msg): boolean

SendMail sends an email using the SMTP protocol.

Parameters

NameType
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 client = new smtp.Client('acme.com', 25);
const isSent = client.SendMail(message);
log(isSent)

Defined in

smtp.ts:67