Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/selectel/pat
Pat, the only SMTP postman!
https://github.com/selectel/pat
community erlang smtp
Last synced: 2 days ago
JSON representation
Pat, the only SMTP postman!
- Host: GitHub
- URL: https://github.com/selectel/pat
- Owner: selectel
- License: mit
- Created: 2013-02-12T08:31:32.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-11-23T22:36:35.000Z (about 2 years ago)
- Last Synced: 2024-03-25T22:22:46.007Z (9 months ago)
- Topics: community, erlang, smtp
- Language: Erlang
- Homepage:
- Size: 23.4 KB
- Stars: 23
- Watchers: 21
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://github.com/selectel/pat/workflows/build/badge.svg)](https://github.com/selectel/pat)
_
|_) _ _|_
| (_| |_-- the only SMTP postman!
`pat` is an easy to use SMTP client for Erlang. You only need to remember
**two** functions:
* `pat:connect/2` takes an SMTP relay as a `{Host, Port}` pair and
a list of supported options (see below) and opens an SMTP connection.
* `pat:send/2` sends a given email via an SMTP connection.Example
-------```erlang
(pat@postoffice)1> Opts = [{user, <<"pat">>}, {password, <<"postman">>}],
(pat@postoffice)2> Conn = pat:connect({<<"smtp.yandex.ru">>, 25}, Opts),
(pat@postoffice)3> rr("include/*").
(pat@postoffice)4> Email = #email{sender= <<"[email protected]">>,
(pat@postoffice)4> recipients=[<<"[email protected]">>],
(pat@postoffice)4> message= <<"Hello world!">>}.
(pat@postoffice)5> pat:send(Conn, Email).
{ok,<<"2.0.0 Ok: queued on smtp13.mail.yandex.net as mM6eOXwj-mM642Fvi">>}
```Options
-------#### `ssl`
**Type**: `boolean()`
**Description**: Connect to the SMTP server using a secure socket.
#### `tls`
**Type**: `never | maybe | always`
**Description**: Connect to the SMTP server via an unsecure socket and
start TLS session afterward. `maybe` means TLS session will be sarted
only if the relay supports `STARTTLS`.#### `auth`
**Type**: `never | maybe | always`
**Description**: Authenticate with the SMTP server after connecting.
When `maybe`, authentication is only performed if the server requires it.#### `user` and `pasword`
**Type**: `binary()`
**Description**: The meaning is self explanatory. Should be used with `auth`.
#### `timeout`
**Type**: `timeout()`
**Description**: Sets a timeout (in seconds) for the underlying
`gen_server`.