smtp

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSMTPClient

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

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

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

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

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

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

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

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

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

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

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

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

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