Namespace: go.std.net.smtp
v1.0Contents
Summary
Provides a low-level interface to the net/smtp package.
Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.
It also implements the following extensions:
8BITMIME RFC 1652
AUTH RFC 2554
STARTTLS RFC 3207
Additional extensions may be handled by clients.
The smtp package is frozen and is not accepting new features.
Some external packages provide more functionality. See:
https://godoc.org/?q=smtp
Index
- *Client
- *ServerInfo
- Auth
- CRAMMD5Auth
- Client
- Dial
- NewClient
- PlainAuth
- SendMail
- ServerInfo
- arrayOfAuth
- arrayOfClient
- arrayOfServerInfo
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
CRAMMD5Auth
Function v1.0(CRAMMD5Auth username secret)
CRAMMD5Auth returns an Auth that implements the CRAM-MD5 authentication
mechanism as defined in RFC 2195.
The returned Auth uses the given username and secret to authenticate
to the server using the challenge-response mechanism.
Go input arguments: (username string, secret string)
Go returns: Auth
Joker input arguments: [^String username, ^String secret]
Joker returns: ^Auth -
Dial
Function v1.0(Dial addr)
Dial returns a new Client connected to an SMTP server at addr.
The addr must include a port, as in "mail.example.com:smtp".
Go input arguments: (addr string)
Go returns: (*Client, error)
Joker input arguments: [^String addr]
Joker returns: [^*Client, ^Error] -
NewClient
Function v1.0(NewClient conn host)
NewClient returns a new Client using an existing connection and host as a
server name to be used when authenticating.
Go input arguments: (conn net.Conn, host string)
Go returns: (*Client, error)
Joker input arguments: [^go.std.net/Conn conn, ^String host]
Joker returns: [^*Client, ^Error] -
PlainAuth
Function v1.0(PlainAuth identity username password host)
PlainAuth returns an Auth that implements the PLAIN authentication
mechanism as defined in RFC 4616. The returned Auth uses the given
username and password to authenticate to host and act as identity.
Usually identity should be the empty string, to act as username.
PlainAuth will only send the credentials if the connection is using TLS
or is connected to localhost. Otherwise authentication will fail with an
error, without sending the credentials.
Go input arguments: (identity string, username string, password string, host string)
Go returns: Auth
Joker input arguments: [^String identity, ^String username, ^String password, ^String host]
Joker returns: ^Auth -
SendMail
Function v1.0(SendMail addr a from to msg)
SendMail connects to the server at addr, switches to TLS if
possible, authenticates with the optional mechanism a if possible,
and then sends an email from address from, to addresses to, with
message msg.
The addr must include a port, as in "mail.example.com:smtp".
The addresses in the to parameter are the SMTP RCPT addresses.
The msg parameter should be an RFC 822-style email with headers
first, a blank line, and then the message body. The lines of msg
should be CRLF terminated. The msg headers should usually include
fields such as "From", "To", "Subject", and "Cc". Sending "Bcc"
messages is accomplished by including an email address in the to
parameter but not including it in the msg headers.
The SendMail function and the net/smtp package are low-level
mechanisms and provide no support for DKIM signing, MIME
attachments (see the mime/multipart package), or other mail
functionality. Higher-level packages exist outside of the standard
library.
Go input arguments: (addr string, a Auth, from string, to []string, msg []byte)
Go returns: error
Joker input arguments: [^String addr, ^Auth a, ^String from, ^arrayOfString to, ^arrayOfByte msg]
Joker returns: ^Error
Types
-
*Client
Concrete Type v1.0A Client represents a client connection to an SMTP server.
-
Auth
Receiver for *Client v1.0([a])
Auth authenticates a client using the provided authentication mechanism.
A failed authentication closes the connection.
Only servers that advertise the AUTH extension support this function.
-
Close
Receiver for *Client v1.0([])
Close closes the connection.
-
Data
Receiver for *Client v1.0([])
Data issues a DATA command to the server and returns a writer that
can be used to write the mail headers and body. The caller should
close the writer before calling any more methods on c. A call to
Data must be preceded by one or more calls to Rcpt.
-
Extension
Receiver for *Client v1.0([ext])
Extension reports whether an extension is support by the server.
The extension name is case-insensitive. If the extension is supported,
Extension also returns a string that contains any parameters the
server specifies for the extension.
-
Hello
Receiver for *Client v1.0([localName])
Hello sends a HELO or EHLO to the server as the given host name.
Calling this method is only necessary if the client needs control
over the host name used. The client will introduce itself as "localhost"
automatically otherwise. If Hello is called, it must be called before
any of the other methods.
-
Mail
Receiver for *Client v1.0([from])
Mail issues a MAIL command to the server using the provided email address.
If the server supports the 8BITMIME extension, Mail adds the BODY=8BITMIME
parameter. If the server supports the SMTPUTF8 extension, Mail adds the
SMTPUTF8 parameter.
This initiates a mail transaction and is followed by one or more Rcpt calls.
-
Noop
Receiver for *Client v1.0([])
Noop sends the NOOP command to the server. It does nothing but check
that the connection to the server is okay.
-
Quit
Receiver for *Client v1.0([])
Quit sends the QUIT command and closes the connection to the server.
-
Rcpt
Receiver for *Client v1.0([to])
Rcpt issues a RCPT command to the server using the provided email address.
A call to Rcpt must be preceded by a call to Mail and may be followed by
a Data call or another Rcpt call.
-
Reset
Receiver for *Client v1.0([])
Reset sends the RSET command to the server, aborting the current mail
transaction.
-
StartTLS
Receiver for *Client v1.0([config])
StartTLS sends the STARTTLS command and encrypts all further communication.
Only servers that advertise the STARTTLS extension support this function.
-
TLSConnectionState
Receiver for *Client v1.0([])
TLSConnectionState returns the client's TLS connection state.
The return values are their zero values if StartTLS did
not succeed.
-
Verify
Receiver for *Client v1.0([addr])
Verify checks the validity of an email address on the server.
If Verify returns nil, the address is valid. A non-nil return
does not necessarily indicate an invalid address. Many servers
will not verify addresses for security reasons.
-
*ServerInfo
Concrete Type v1.0ServerInfo records information about an SMTP server.
-
Auth
Abstract Type v1.0Auth is implemented by an SMTP authentication mechanism.
-
Next
Method for Auth v1.0([fromServer more])
-
Start
Method for Auth v1.0([server])
-
Client
Concrete Type v1.0A Client represents a client connection to an SMTP server.
-
ServerInfo
Concrete Type v1.0ServerInfo records information about an SMTP server.
-
arrayOfAuth
Concrete Type v1.0Auth is implemented by an SMTP authentication mechanism.
-
arrayOfClient
Concrete Type v1.0A Client represents a client connection to an SMTP server.
-
arrayOfServerInfo
Concrete Type v1.0ServerInfo records information about an SMTP server.