smtp

package
v3.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2024 License: MIT, Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSMTPClient added in v3.2.0

func NewSMTPClient(call goja.ConstructorCall, runtime *goja.Runtime) *goja.Object

Constructor for SMTP Client Constructor: constructor(public host: string, public port: string)

Types

type Client added in v3.2.0

type Client struct {
	// contains filtered or unexported fields
}

Client is a minimal SMTP client for nuclei scripts. @example ```javascript const smtp = require('nuclei/smtp'); const client = new smtp.Client('acme.com', 25); ```

func (*Client) IsOpenRelay added in v3.2.0

func (c *Client) IsOpenRelay(msg *SMTPMessage) (bool, error)

IsOpenRelay checks if a host is an open relay. @example ```javascript 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); ```

func (*Client) IsSMTP added in v3.2.0

func (c *Client) IsSMTP() (SMTPResponse, error)

IsSMTP checks if a host is running a SMTP server. @example ```javascript const smtp = require('nuclei/smtp'); const client = new smtp.Client('acme.com', 25); const isSMTP = client.IsSMTP(); log(isSMTP) ```

func (*Client) SendMail added in v3.2.0

func (c *Client) SendMail(msg *SMTPMessage) (bool, error)

SendMail sends an email using the SMTP protocol. @example ```javascript 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) ```

type SMTPMessage added in v3.1.3

type SMTPMessage struct {
	// contains filtered or unexported fields
}

SMTPMessage is a message to be sent over SMTP @example ```javascript const smtp = require('nuclei/smtp'); const message = new smtp.SMTPMessage(); message.From('xyz@projectdiscovery.io'); ```

func (*SMTPMessage) Auth added in v3.1.3

func (s *SMTPMessage) Auth(username, password string) *SMTPMessage

Auth when called authenticates using username and password before sending the message @example ```javascript const smtp = require('nuclei/smtp'); const message = new smtp.SMTPMessage(); message.Auth('username', 'password'); ```

func (*SMTPMessage) Body added in v3.1.3

func (s *SMTPMessage) Body(msg []byte) *SMTPMessage

Body adds the message body to the message @example ```javascript const smtp = require('nuclei/smtp'); const message = new smtp.SMTPMessage(); message.Body('hello'); ```

func (*SMTPMessage) From added in v3.1.3

func (s *SMTPMessage) From(email string) *SMTPMessage

From adds the from field to the message @example ```javascript const smtp = require('nuclei/smtp'); const message = new smtp.SMTPMessage(); message.From('xyz@projectdiscovery.io'); ```

func (*SMTPMessage) String added in v3.1.3

func (s *SMTPMessage) String() string

String returns the string representation of the message @example ```javascript 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'); log(message.String()); ```

func (*SMTPMessage) Subject added in v3.1.3

func (s *SMTPMessage) Subject(sub string) *SMTPMessage

Subject adds the subject field to the message @example ```javascript const smtp = require('nuclei/smtp'); const message = new smtp.SMTPMessage(); message.Subject('hello'); ```

func (*SMTPMessage) To added in v3.1.3

func (s *SMTPMessage) To(email string) *SMTPMessage

To adds the to field to the message @example ```javascript const smtp = require('nuclei/smtp'); const message = new smtp.SMTPMessage(); message.To('xyz@projectdiscovery.io'); ```

type SMTPResponse added in v3.2.0

type SMTPResponse struct {
	IsSMTP bool
	Banner string
}

SMTPResponse is the response from the IsSMTP function. @example ```javascript const smtp = require('nuclei/smtp'); const client = new smtp.Client('acme.com', 25); const isSMTP = client.IsSMTP(); log(isSMTP) ```

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL