Merge pull request #134 from amousset/master
Add redirection for index page
This commit is contained in:
@@ -5,3 +5,4 @@ theme = "hugo-theme-learn"
|
|||||||
search = true
|
search = true
|
||||||
author = "Alexis Mousset"
|
author = "Alexis Mousset"
|
||||||
publishDir = "../docs"
|
publishDir = "../docs"
|
||||||
|
PygmentsCodeFences = true
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ The file transport writes the emails to the given directory. The name of the fil
|
|||||||
`message_id.txt`.
|
`message_id.txt`.
|
||||||
It can be useful for testing purposes, or if you want to keep track of sent messages.
|
It can be useful for testing purposes, or if you want to keep track of sent messages.
|
||||||
|
|
||||||
{{< highlight rust >}}
|
``` rust
|
||||||
use std::env::temp_dir;
|
use std::env::temp_dir;
|
||||||
|
|
||||||
use lettre::file::FileEmailTransport;
|
use lettre::file::FileEmailTransport;
|
||||||
@@ -27,7 +27,7 @@ let email = SimpleSendableEmail::new(
|
|||||||
|
|
||||||
let result = sender.send(email);
|
let result = sender.send(email);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
{{< /highlight >}}
|
```
|
||||||
|
|
||||||
Example result in `/tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.txt`:
|
Example result in `/tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.txt`:
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ weight = 3
|
|||||||
|
|
||||||
The sendmail transport sends the email using the local sendmail command.
|
The sendmail transport sends the email using the local sendmail command.
|
||||||
|
|
||||||
{{< highlight rust >}}
|
``` rust
|
||||||
use lettre::sendmail::SendmailTransport;
|
use lettre::sendmail::SendmailTransport;
|
||||||
use lettre::{SimpleSendableEmail, EmailTransport};
|
use lettre::{SimpleSendableEmail, EmailTransport};
|
||||||
|
|
||||||
@@ -22,4 +22,4 @@ let email = SimpleSendableEmail::new(
|
|||||||
let mut sender = SendmailTransport::new();
|
let mut sender = SendmailTransport::new();
|
||||||
let result = sender.send(email);
|
let result = sender.send(email);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
{{< /highlight >}}
|
```
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ The relay server can be the local email server, a specific host or a third-party
|
|||||||
|
|
||||||
This is the most basic example of usage:
|
This is the most basic example of usage:
|
||||||
|
|
||||||
{{< highlight rust >}}
|
``` rust
|
||||||
use lettre::{SimpleSendableEmail, EmailTransport};
|
use lettre::{SimpleSendableEmail, EmailTransport};
|
||||||
use lettre::smtp::SmtpTransportBuilder;
|
use lettre::smtp::SmtpTransportBuilder;
|
||||||
use lettre::smtp::SecurityLevel;
|
use lettre::smtp::SecurityLevel;
|
||||||
@@ -42,11 +42,11 @@ SmtpTransportBuilder::localhost().unwrap().security_level(SecurityLevel::Opportu
|
|||||||
let result = mailer.send(email);
|
let result = mailer.send(email);
|
||||||
|
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
{{< /highlight >}}
|
```
|
||||||
|
|
||||||
#### Complete example
|
#### Complete example
|
||||||
|
|
||||||
{{< highlight rust >}}
|
``` rust
|
||||||
use lettre::smtp::{SecurityLevel, SmtpTransport,
|
use lettre::smtp::{SecurityLevel, SmtpTransport,
|
||||||
SmtpTransportBuilder};
|
SmtpTransportBuilder};
|
||||||
use lettre::smtp::authentication::Mechanism;
|
use lettre::smtp::authentication::Mechanism;
|
||||||
@@ -86,14 +86,14 @@ assert!(result_2.is_ok());
|
|||||||
|
|
||||||
// Explicitly close the SMTP transaction as we enabled connection reuse
|
// Explicitly close the SMTP transaction as we enabled connection reuse
|
||||||
mailer.close();
|
mailer.close();
|
||||||
{{< /highlight >}}
|
```
|
||||||
|
|
||||||
#### Lower level
|
#### Lower level
|
||||||
|
|
||||||
You can also send commands, here is a simple email transaction without
|
You can also send commands, here is a simple email transaction without
|
||||||
error handling:
|
error handling:
|
||||||
|
|
||||||
{{< highlight rust >}}
|
``` rust
|
||||||
use lettre::smtp::SMTP_PORT;
|
use lettre::smtp::SMTP_PORT;
|
||||||
use lettre::smtp::client::Client;
|
use lettre::smtp::client::Client;
|
||||||
use lettre::smtp::client::net::NetworkStream;
|
use lettre::smtp::client::net::NetworkStream;
|
||||||
@@ -106,5 +106,5 @@ let _ = email_client.rcpt("user@example.org");
|
|||||||
let _ = email_client.data();
|
let _ = email_client.data();
|
||||||
let _ = email_client.message("Test email");
|
let _ = email_client.message("Test email");
|
||||||
let _ = email_client.quit();
|
let _ = email_client.quit();
|
||||||
{{< /highlight >}}
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ weight = 5
|
|||||||
The stub transport only logs message envelope and drops the content. It can be useful for
|
The stub transport only logs message envelope and drops the content. It can be useful for
|
||||||
testing purposes.
|
testing purposes.
|
||||||
|
|
||||||
{{< highlight rust >}}
|
``` rust
|
||||||
use lettre::stub::StubEmailTransport;
|
use lettre::stub::StubEmailTransport;
|
||||||
use lettre::{SimpleSendableEmail, EmailTransport};
|
use lettre::{SimpleSendableEmail, EmailTransport};
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ let email = SimpleSendableEmail::new(
|
|||||||
let mut sender = StubEmailTransport;
|
let mut sender = StubEmailTransport;
|
||||||
let result = sender.send(email);
|
let result = sender.send(email);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
{{< /highlight >}}
|
```
|
||||||
|
|
||||||
Will log the line:
|
Will log the line:
|
||||||
|
|
||||||
|
|||||||
1
website/layouts/index.html
Normal file
1
website/layouts/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<meta http-equiv="refresh" content="0; url=https://lettre.github.io/lettre/getting-started/intro/"/>
|
||||||
Reference in New Issue
Block a user