Merge pull request #219 from amousset/fix-doc
fix(all): Fix documentation issues
This commit is contained in:
@@ -17,6 +17,11 @@ Lettre provides the following features:
|
|||||||
* Secure delivery with SMTP using encryption and authentication
|
* Secure delivery with SMTP using encryption and authentication
|
||||||
* Easy email builders
|
* Easy email builders
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
See https://github.com/lettre/lettre/blob/master/lettre_email/examples/smtp.rs
|
||||||
|
for a simple example of how to build and send an email.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Released versions:
|
Released versions:
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
<title>404 Page not found</title>
|
<title>404 Page not found</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/horsey.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/horsey.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left {
|
:root #header + #content > #left > #rlblock_left {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Creating messages :: Lettre site</title>
|
<title>Creating messages :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -362,6 +362,8 @@
|
|||||||
|
|
||||||
<h3 id="creating-messages">Creating messages</h3>
|
<h3 id="creating-messages">Creating messages</h3>
|
||||||
|
|
||||||
|
<p>The documentation for the <code>lettre_email</code> is available on <a href="https://docs.rs/lettre_email/0.7.0/lettre_email/">https://docs.rs/lettre_email/0.7.0/lettre_email/</a> for now.</p>
|
||||||
|
|
||||||
|
|
||||||
<footer class=" footline" >
|
<footer class=" footline" >
|
||||||
|
|
||||||
@@ -561,20 +563,20 @@
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Getting started :: Lettre site</title>
|
<title>Getting started :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -560,20 +560,20 @@
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Introduction :: Lettre site</title>
|
<title>Introduction :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -566,20 +566,20 @@ Please use <a href="https://docs.rs/lettre/0.6.2/lettre/">https://docs.rs/lettre
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"uri": "/content/creating-messages/_index",
|
"uri": "/content/creating-messages/_index",
|
||||||
"title": "Creating messages",
|
"title": "Creating messages",
|
||||||
"content": "\nCreating messages\n",
|
"content": "\nCreating messages\n\nThe documentation for the lettreemail is available on https://docs.rs/lettreemail/0.7.0/lettre_email/ for now.\n\n",
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
{
|
{
|
||||||
"uri": "/content/sending-messages/smtp",
|
"uri": "/content/sending-messages/smtp",
|
||||||
"title": "SMTP transport",
|
"title": "SMTP transport",
|
||||||
"content": "\nThis transport uses the SMTP protocol to send emails over the network (locally or remotely).\n\nIt is desinged to be:\n\nSecured: email are encrypted by default\nModern: Unicode support for email content and sender/recipient adresses when compatible\nFast: supports tcp connection reuse\n\nThis client is designed to send emails to a relay server, and should not be used to send\nemails directly to the destination.\n\nThe relay server can be the local email server, a specific host or a third-party service.\n\nSimple example\n\nThis is the most basic example of usage:\n\nuse lettre::{SimpleSendableEmail, EmailTransport, EmailAddress, SmtpTransport};\n\nlet email = SimpleSendableEmail::new(\n EmailAddress::new(\"user@localhost\".to_string()),\n vec![EmailAddress::new(\"root@localhost\".to_string())],\n \"messageid\".tostring(),\n \"Hello world\".to_string(),\n );\n\n// Open a local connection on port 25\nlet mut mailer =\nSmtpTransport::builderunencryptedlocalhost().unwrap().build();\n// Send the email\nlet result = mailer.send(&email);\n\nassert!(result.is_ok());\n\n Complete example\n\nuse lettre::smtp::authentication::{Credentials, Mechanism};\nuse lettre::smtp::SUBMISSION_PORT;\nuse lettre::{SimpleSendableEmail, EmailTransport, EmailAddress, SmtpTransport};\nuse lettre::smtp::extension::ClientId;\nuse lettre::smtp::ConnectionReuseParameters;\n\nlet email = SimpleSendableEmail::new(\n EmailAddress::new(\"user@localhost\".to_string()),\n vec![EmailAddress::new(\"root@localhost\".to_string())],\n \"messageid\".tostring(),\n \"Hello world\".to_string(),\n );\n\n// Connect to a remote server on a custom port\nlet mut mailer = SmtpTransport::simplebuilder(\"server.tld\".tostring()).unwrap()\n // Set the name sent during EHLO/HELO, default is localhost\n .helloname(ClientId::Domain(\"my.hostname.tld\".tostring()))\n // Add credentials for authentication\n .credentials(Credentials::new(\"username\".tostring(), \"password\".tostring()))\n // Enable SMTPUTF8 if the server supports it\n .smtp_utf8(true)\n // Configure expected authentication mechanism\n .authentication_mechanism(Mechanism::Plain)\n // Enable connection reuse\n .connection_reuse(ConnectionReuseParameters::ReuseUnlimited).build();\n\nlet result_1 = mailer.send(&email);\nassert!(result1.isok());\n\n// The second email will use the same connection\nlet result_2 = mailer.send(&email);\nassert!(result2.isok());\n\n// Explicitly close the SMTP transaction as we enabled connection reuse\nmailer.close();\n\nLower level\n\nYou can also send commands, here is a simple email transaction without\nerror handling:\n\nuse lettre::EmailAddress;\nuse lettre::smtp::SMTP_PORT;\nuse lettre::smtp::client::Client;\nuse lettre::smtp::client::net::NetworkStream;\nuse lettre::smtp::extension::ClientId;\nuse lettre::smtp::commands::*;\n\nlet mut email_client: ClientNetworkStream = Client::new();\nlet _ = emailclient.connect(&(\"localhost\", SMTPPORT), None);\nlet _ = emailclient.smtpcommand(EhloCommand::new(ClientId::new(\"myhostname\".tostring())));\nlet _ = emailclient.smtpcommand(\n MailCommand::new(Some(EmailAddress::new(\"user@example.com\".to_string())), vec![])\n );\nlet _ = emailclient.smtpcommand(\n RcptCommand::new(EmailAddress::new(\"user@example.org\".to_string()), vec![])\n );\nlet _ = emailclient.smtpcommand(DataCommand);\nlet _ = emailclient.message(Box::new(\"Test email\".asbytes()));\nlet _ = emailclient.smtpcommand(QuitCommand);\n\n",
|
"content": "\nThis transport uses the SMTP protocol to send emails over the network (locally or remotely).\n\nIt is desinged to be:\n\nSecured: email are encrypted by default\nModern: Unicode support for email content and sender/recipient adresses when compatible\nFast: supports tcp connection reuse\n\nThis client is designed to send emails to a relay server, and should not be used to send\nemails directly to the destination.\n\nThe relay server can be the local email server, a specific host or a third-party service.\n\nSimple example\n\nThis is the most basic example of usage:\n\nuse lettre::{SimpleSendableEmail, EmailTransport, EmailAddress, SmtpTransport};\n\nlet email = SimpleSendableEmail::new(\n EmailAddress::new(\"user@localhost\".to_string()),\n vec![EmailAddress::new(\"root@localhost\".to_string())],\n \"messageid\".tostring(),\n \"Hello world\".to_string(),\n );\n\n// Open a local connection on port 25\nlet mut mailer =\nSmtpTransport::builderunencryptedlocalhost().unwrap().build();\n// Send the email\nlet result = mailer.send(&email);\n\nassert!(result.is_ok());\n\n Complete example\n\nuse lettre::smtp::authentication::{Credentials, Mechanism};\nuse lettre::smtp::SUBMISSION_PORT;\nuse lettre::{SimpleSendableEmail, EmailTransport, EmailAddress, SmtpTransport};\nuse lettre::smtp::extension::ClientId;\nuse lettre::smtp::ConnectionReuseParameters;\n\nlet email = SimpleSendableEmail::new(\n EmailAddress::new(\"user@localhost\".to_string()),\n vec![EmailAddress::new(\"root@localhost\".to_string())],\n \"messageid\".tostring(),\n \"Hello world\".to_string(),\n );\n\n// Connect to a remote server on a custom port\nlet mut mailer = SmtpTransport::simplebuilder(\"server.tld\".tostring()).unwrap()\n // Set the name sent during EHLO/HELO, default is localhost\n .helloname(ClientId::Domain(\"my.hostname.tld\".tostring()))\n // Add credentials for authentication\n .credentials(Credentials::new(\"username\".tostring(), \"password\".tostring()))\n // Enable SMTPUTF8 if the server supports it\n .smtp_utf8(true)\n // Configure expected authentication mechanism\n .authentication_mechanism(Mechanism::Plain)\n // Enable connection reuse\n .connection_reuse(ConnectionReuseParameters::ReuseUnlimited).build();\n\nlet result_1 = mailer.send(&email);\nassert!(result1.isok());\n\n// The second email will use the same connection\nlet result_2 = mailer.send(&email);\nassert!(result2.isok());\n\n// Explicitly close the SMTP transaction as we enabled connection reuse\nmailer.close();\n\nLower level\n\nYou can also send commands, here is a simple email transaction without\nerror handling:\n\nuse lettre::EmailAddress;\nuse lettre::smtp::SMTP_PORT;\nuse lettre::smtp::client::Client;\nuse lettre::smtp::client::net::NetworkStream;\nuse lettre::smtp::extension::ClientId;\nuse lettre::smtp::commands::*;\n\nlet mut email_client: ClientNetworkStream = Client::new();\nlet _ = emailclient.connect(&(\"localhost\", SMTPPORT), None);\nlet _ = emailclient.command(EhloCommand::new(ClientId::new(\"myhostname\".to_string())));\nlet _ = email_client.command(\n MailCommand::new(Some(EmailAddress::new(\"user@example.com\".to_string())), vec![])\n );\nlet _ = email_client.command(\n RcptCommand::new(EmailAddress::new(\"user@example.org\".to_string()), vec![])\n );\nlet _ = email_client.command(DataCommand);\nlet _ = emailclient.message(Box::new(\"Test email\".asbytes()));\nlet _ = email_client.command(QuitCommand);\n\n",
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ The relay server can be the local email server, a specific host or a third-party
|
|||||||
|
|
||||||
<guid>https://lettre.github.io/lettre/sending-messages/sendmail/</guid>
|
<guid>https://lettre.github.io/lettre/sending-messages/sendmail/</guid>
|
||||||
<description>The sendmail transport sends the email using the local sendmail command.
|
<description>The sendmail transport sends the email using the local sendmail command.
|
||||||
uselettre::sendmail::SendmailTransport;uselettre::{SimpleSendableEmail,EmailTransport,EmailAddress};letemail=SimpleSendableEmail::new(EmailAddress::new(&#34;user@localhost&#34;.to_string()),vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())],&#34;message_id&#34;.to_string(),&#34;Hello world&#34;.to_string(),);letmutsender=SendmailTransport::new();letresult=sender.send(&amp;email);assert!(result.is_ok()); </description>
|
use lettre::sendmail::SendmailTransport; use lettre::{SimpleSendableEmail, EmailTransport, EmailAddress}; let email = SimpleSendableEmail::new( EmailAddress::new(&#34;user@localhost&#34;.to_string()), vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())], &#34;message_id&#34;.to_string(), &#34;Hello world&#34;.to_string(), ); let mut sender = SendmailTransport::new(); let result = sender.send(&amp;email); assert!</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
@@ -62,8 +62,7 @@ uselettre::sendmail::SendmailTransport;uselettre::{SimpleSendableEmail,EmailTran
|
|||||||
|
|
||||||
<guid>https://lettre.github.io/lettre/sending-messages/file/</guid>
|
<guid>https://lettre.github.io/lettre/sending-messages/file/</guid>
|
||||||
<description>The file transport writes the emails to the given directory. The name of the file will be message_id.txt. It can be useful for testing purposes, or if you want to keep track of sent messages.
|
<description>The file transport writes the emails to the given directory. The name of the file will be message_id.txt. It can be useful for testing purposes, or if you want to keep track of sent messages.
|
||||||
usestd::env::temp_dir;uselettre::file::FileEmailTransport;uselettre::{SimpleSendableEmail,EmailTransport,EmailAddress};// Write to the local temp directory letmutsender=FileEmailTransport::new(temp_dir());letemail=SimpleSendableEmail::new(EmailAddress::new(&#34;user@localhost&#34;.to_string()),vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())],&#34;message_id&#34;.to_string(),&#34;Hello world&#34;.to_string(),);letresult=sender.send(&amp;email);assert!(result.is_ok()); Example result in /tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.txt:
|
use std::env::temp_dir; use lettre::file::FileEmailTransport; use lettre::{SimpleSendableEmail, EmailTransport, EmailAddress}; // Write to the local temp directory let mut sender = FileEmailTransport::new(temp_dir()); let email = SimpleSendableEmail::new( EmailAddress::new(&#34;user@localhost&#34;.to_string()), vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())], &#34;message_id&#34;.to_string(), &#34;Hello world&#34;.to_string(), ); let result = sender.send(&amp;email); assert!(result.is_ok()); Example result in /tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.</description>
|
||||||
b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&lt;root@localhost&gt; To: &lt;root@localhost&gt; From: &lt;user@localhost&gt; Subject: Hello Date: Sat, 31 Oct 2015 13:42:19 +0100 Message-ID: &lt;b7c211bc-9811-45ce-8cd9-68eab575d695.lettre@localhost&gt; Hello World! </description>
|
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
@@ -73,8 +72,8 @@ b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&am
|
|||||||
|
|
||||||
<guid>https://lettre.github.io/lettre/sending-messages/stub/</guid>
|
<guid>https://lettre.github.io/lettre/sending-messages/stub/</guid>
|
||||||
<description>The stub transport only logs message envelope and drops the content. It can be useful for testing purposes.
|
<description>The stub transport only logs message envelope and drops the content. It can be useful for testing purposes.
|
||||||
uselettre::stub::StubEmailTransport;uselettre::{SimpleSendableEmail,EmailTransport,EmailAddress};letemail=SimpleSendableEmail::new(EmailAddress::new(&#34;user@localhost&#34;.to_string()),vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())],&#34;message_id&#34;.to_string(),&#34;Hello world&#34;.to_string(),);letmutsender=StubEmailTransport::new_positive();letresult=sender.send(&amp;email);assert!(result.is_ok()); Will log (when using a logger like env_logger):
|
use lettre::stub::StubEmailTransport; use lettre::{SimpleSendableEmail, EmailTransport, EmailAddress}; let email = SimpleSendableEmail::new( EmailAddress::new(&#34;user@localhost&#34;.to_string()), vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())], &#34;message_id&#34;.to_string(), &#34;Hello world&#34;.to_string(), ); let mut sender = StubEmailTransport::new_positive(); let result = sender.send(&amp;email); assert!(result.is_ok()); Will log (when using a logger like env_logger):
|
||||||
b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&lt;root@localhost&gt; </description>
|
b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&lt;root@localhost&gt;</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>File transport :: Lettre site</title>
|
<title>File transport :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -357,33 +357,31 @@
|
|||||||
<p>The file transport writes the emails to the given directory. The name of the file will be
|
<p>The file transport writes the emails to the given directory. The name of the file will be
|
||||||
<code>message_id.txt</code>.
|
<code>message_id.txt</code>.
|
||||||
It can be useful for testing purposes, or if you want to keep track of sent messages.</p>
|
It can be useful for testing purposes, or if you want to keep track of sent messages.</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span><span style=""> </span><span style="">std</span><span style="">::</span><span style="">env</span><span style="">::</span><span style="">temp_dir</span><span style="">;</span><span style="">
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span> std::env::temp_dir;
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">file</span><span style="">::</span><span style="">FileEmailTransport</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::file::FileEmailTransport;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">{</span><span style="">SimpleSendableEmail</span><span style="">,</span><span style=""> </span><span style="">EmailTransport</span><span style="">,</span><span style=""> </span><span style="">EmailAddress</span><span style="">};</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::{SimpleSendableEmail, EmailTransport, EmailAddress};
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#75715e">// Write to the local temp directory
|
<span style="color:#75715e">// Write to the local temp directory
|
||||||
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="color:#66d9ef">mut</span><span style=""> </span><span style="">sender</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">FileEmailTransport</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">temp_dir</span><span style="">());</span><span style="">
|
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span> <span style="color:#66d9ef">mut</span> sender <span style="color:#f92672">=</span> FileEmailTransport::new(temp_dir());
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">email</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SimpleSendableEmail</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> email <span style="color:#f92672">=</span> SimpleSendableEmail::new(
|
||||||
</span><span style=""> </span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">()),</span><span style="">
|
EmailAddress::new(<span style="color:#e6db74">"user@localhost"</span>.to_string()),
|
||||||
</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"root@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">())],</span><span style="">
|
vec<span style="color:#f92672">!</span>[EmailAddress::new(<span style="color:#e6db74">"root@localhost"</span>.to_string())],
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"message_id"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"message_id"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"Hello world"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"Hello world"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">result</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">sender</span><span style="">.</span><span style="">send</span><span style="">(</span><span style="color:#f92672">&</span><span style="">email</span><span style="">);</span><span style="">
|
<span style="color:#66d9ef">let</span> result <span style="color:#f92672">=</span> sender.send(<span style="color:#f92672">&</span>email);
|
||||||
</span><span style=""></span><span style="">assert</span><span style="color:#f92672">!</span><span style="">(</span><span style="">result</span><span style="">.</span><span style="">is_ok</span><span style="">());</span></code></pre>
|
assert<span style="color:#f92672">!</span>(result.is_ok());</code></pre></div>
|
||||||
</div>
|
|
||||||
<p>Example result in <code>/tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.txt</code>:</p>
|
<p>Example result in <code>/tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.txt</code>:</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text"><span style="">b7c211bc-9811-45ce-8cd9-68eab575d695: from=<user@localhost> to=<root@localhost>
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">b7c211bc-9811-45ce-8cd9-68eab575d695: from=<user@localhost> to=<root@localhost>
|
||||||
</span><span style="">To: <root@localhost>
|
To: <root@localhost>
|
||||||
</span><span style="">From: <user@localhost>
|
From: <user@localhost>
|
||||||
</span><span style="">Subject: Hello
|
Subject: Hello
|
||||||
</span><span style="">Date: Sat, 31 Oct 2015 13:42:19 +0100
|
Date: Sat, 31 Oct 2015 13:42:19 +0100
|
||||||
</span><span style="">Message-ID: <b7c211bc-9811-45ce-8cd9-68eab575d695.lettre@localhost>
|
Message-ID: <b7c211bc-9811-45ce-8cd9-68eab575d695.lettre@localhost>
|
||||||
</span><span style="">
|
|
||||||
</span><span style="">Hello World!</span></code></pre>
|
Hello World!</code></pre></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class=" footline" >
|
<footer class=" footline" >
|
||||||
|
|
||||||
@@ -588,20 +586,20 @@ It can be useful for testing purposes, or if you want to keep track of sent mess
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Sending messages :: Lettre site</title>
|
<title>Sending messages :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -563,20 +563,20 @@
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ The relay server can be the local email server, a specific host or a third-party
|
|||||||
|
|
||||||
<guid>https://lettre.github.io/lettre/sending-messages/sendmail/</guid>
|
<guid>https://lettre.github.io/lettre/sending-messages/sendmail/</guid>
|
||||||
<description>The sendmail transport sends the email using the local sendmail command.
|
<description>The sendmail transport sends the email using the local sendmail command.
|
||||||
uselettre::sendmail::SendmailTransport;uselettre::{SimpleSendableEmail,EmailTransport,EmailAddress};letemail=SimpleSendableEmail::new(EmailAddress::new(&#34;user@localhost&#34;.to_string()),vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())],&#34;message_id&#34;.to_string(),&#34;Hello world&#34;.to_string(),);letmutsender=SendmailTransport::new();letresult=sender.send(&amp;email);assert!(result.is_ok()); </description>
|
use lettre::sendmail::SendmailTransport; use lettre::{SimpleSendableEmail, EmailTransport, EmailAddress}; let email = SimpleSendableEmail::new( EmailAddress::new(&#34;user@localhost&#34;.to_string()), vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())], &#34;message_id&#34;.to_string(), &#34;Hello world&#34;.to_string(), ); let mut sender = SendmailTransport::new(); let result = sender.send(&amp;email); assert!</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
@@ -51,8 +51,7 @@ uselettre::sendmail::SendmailTransport;uselettre::{SimpleSendableEmail,EmailTran
|
|||||||
|
|
||||||
<guid>https://lettre.github.io/lettre/sending-messages/file/</guid>
|
<guid>https://lettre.github.io/lettre/sending-messages/file/</guid>
|
||||||
<description>The file transport writes the emails to the given directory. The name of the file will be message_id.txt. It can be useful for testing purposes, or if you want to keep track of sent messages.
|
<description>The file transport writes the emails to the given directory. The name of the file will be message_id.txt. It can be useful for testing purposes, or if you want to keep track of sent messages.
|
||||||
usestd::env::temp_dir;uselettre::file::FileEmailTransport;uselettre::{SimpleSendableEmail,EmailTransport,EmailAddress};// Write to the local temp directory letmutsender=FileEmailTransport::new(temp_dir());letemail=SimpleSendableEmail::new(EmailAddress::new(&#34;user@localhost&#34;.to_string()),vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())],&#34;message_id&#34;.to_string(),&#34;Hello world&#34;.to_string(),);letresult=sender.send(&amp;email);assert!(result.is_ok()); Example result in /tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.txt:
|
use std::env::temp_dir; use lettre::file::FileEmailTransport; use lettre::{SimpleSendableEmail, EmailTransport, EmailAddress}; // Write to the local temp directory let mut sender = FileEmailTransport::new(temp_dir()); let email = SimpleSendableEmail::new( EmailAddress::new(&#34;user@localhost&#34;.to_string()), vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())], &#34;message_id&#34;.to_string(), &#34;Hello world&#34;.to_string(), ); let result = sender.send(&amp;email); assert!(result.is_ok()); Example result in /tmp/b7c211bc-9811-45ce-8cd9-68eab575d695.</description>
|
||||||
b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&lt;root@localhost&gt; To: &lt;root@localhost&gt; From: &lt;user@localhost&gt; Subject: Hello Date: Sat, 31 Oct 2015 13:42:19 +0100 Message-ID: &lt;b7c211bc-9811-45ce-8cd9-68eab575d695.lettre@localhost&gt; Hello World! </description>
|
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
@@ -62,8 +61,8 @@ b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&am
|
|||||||
|
|
||||||
<guid>https://lettre.github.io/lettre/sending-messages/stub/</guid>
|
<guid>https://lettre.github.io/lettre/sending-messages/stub/</guid>
|
||||||
<description>The stub transport only logs message envelope and drops the content. It can be useful for testing purposes.
|
<description>The stub transport only logs message envelope and drops the content. It can be useful for testing purposes.
|
||||||
uselettre::stub::StubEmailTransport;uselettre::{SimpleSendableEmail,EmailTransport,EmailAddress};letemail=SimpleSendableEmail::new(EmailAddress::new(&#34;user@localhost&#34;.to_string()),vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())],&#34;message_id&#34;.to_string(),&#34;Hello world&#34;.to_string(),);letmutsender=StubEmailTransport::new_positive();letresult=sender.send(&amp;email);assert!(result.is_ok()); Will log (when using a logger like env_logger):
|
use lettre::stub::StubEmailTransport; use lettre::{SimpleSendableEmail, EmailTransport, EmailAddress}; let email = SimpleSendableEmail::new( EmailAddress::new(&#34;user@localhost&#34;.to_string()), vec![EmailAddress::new(&#34;root@localhost&#34;.to_string())], &#34;message_id&#34;.to_string(), &#34;Hello world&#34;.to_string(), ); let mut sender = StubEmailTransport::new_positive(); let result = sender.send(&amp;email); assert!(result.is_ok()); Will log (when using a logger like env_logger):
|
||||||
b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&lt;root@localhost&gt; </description>
|
b7c211bc-9811-45ce-8cd9-68eab575d695: from=&lt;user@localhost&gt; to=&lt;root@localhost&gt;</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Introduction :: Lettre site</title>
|
<title>Introduction :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -571,20 +571,20 @@ logs.</li>
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Sendmail transport :: Lettre site</title>
|
<title>Sendmail transport :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -355,20 +355,19 @@
|
|||||||
|
|
||||||
|
|
||||||
<p>The sendmail transport sends the email using the local sendmail command.</p>
|
<p>The sendmail transport sends the email using the local sendmail command.</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">sendmail</span><span style="">::</span><span style="">SendmailTransport</span><span style="">;</span><span style="">
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span> lettre::sendmail::SendmailTransport;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">{</span><span style="">SimpleSendableEmail</span><span style="">,</span><span style=""> </span><span style="">EmailTransport</span><span style="">,</span><span style=""> </span><span style="">EmailAddress</span><span style="">};</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::{SimpleSendableEmail, EmailTransport, EmailAddress};
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">email</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SimpleSendableEmail</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> email <span style="color:#f92672">=</span> SimpleSendableEmail::new(
|
||||||
</span><span style=""> </span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">()),</span><span style="">
|
EmailAddress::new(<span style="color:#e6db74">"user@localhost"</span>.to_string()),
|
||||||
</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"root@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">())],</span><span style="">
|
vec<span style="color:#f92672">!</span>[EmailAddress::new(<span style="color:#e6db74">"root@localhost"</span>.to_string())],
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"message_id"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"message_id"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"Hello world"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"Hello world"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="color:#66d9ef">mut</span><span style=""> </span><span style="">sender</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SendmailTransport</span><span style="">::</span><span style="">new</span><span style="">();</span><span style="">
|
<span style="color:#66d9ef">let</span> <span style="color:#66d9ef">mut</span> sender <span style="color:#f92672">=</span> SendmailTransport::new();
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">result</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">sender</span><span style="">.</span><span style="">send</span><span style="">(</span><span style="color:#f92672">&</span><span style="">email</span><span style="">);</span><span style="">
|
<span style="color:#66d9ef">let</span> result <span style="color:#f92672">=</span> sender.send(<span style="color:#f92672">&</span>email);
|
||||||
</span><span style=""></span><span style="">assert</span><span style="color:#f92672">!</span><span style="">(</span><span style="">result</span><span style="">.</span><span style="">is_ok</span><span style="">());</span></code></pre>
|
assert<span style="color:#f92672">!</span>(result.is_ok());</code></pre></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class=" footline" >
|
<footer class=" footline" >
|
||||||
|
|
||||||
@@ -573,20 +572,20 @@
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>SMTP transport :: Lettre site</title>
|
<title>SMTP transport :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -389,85 +389,82 @@ emails directly to the destination.</p>
|
|||||||
<h4 id="simple-example">Simple example</h4>
|
<h4 id="simple-example">Simple example</h4>
|
||||||
|
|
||||||
<p>This is the most basic example of usage:</p>
|
<p>This is the most basic example of usage:</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">{</span><span style="">SimpleSendableEmail</span><span style="">,</span><span style=""> </span><span style="">EmailTransport</span><span style="">,</span><span style=""> </span><span style="">EmailAddress</span><span style="">,</span><span style=""> </span><span style="">SmtpTransport</span><span style="">};</span><span style="">
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span> lettre::{SimpleSendableEmail, EmailTransport, EmailAddress, SmtpTransport};
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">email</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SimpleSendableEmail</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> email <span style="color:#f92672">=</span> SimpleSendableEmail::new(
|
||||||
</span><span style=""> </span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">()),</span><span style="">
|
EmailAddress::new(<span style="color:#e6db74">"user@localhost"</span>.to_string()),
|
||||||
</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"root@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">())],</span><span style="">
|
vec<span style="color:#f92672">!</span>[EmailAddress::new(<span style="color:#e6db74">"root@localhost"</span>.to_string())],
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"message_id"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"message_id"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"Hello world"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"Hello world"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#75715e">// Open a local connection on port 25
|
<span style="color:#75715e">// Open a local connection on port 25
|
||||||
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="color:#66d9ef">mut</span><span style=""> </span><span style="">mailer</span><span style=""> </span><span style="color:#f92672">=</span><span style="">
|
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span> <span style="color:#66d9ef">mut</span> mailer <span style="color:#f92672">=</span>
|
||||||
</span><span style=""></span><span style="">SmtpTransport</span><span style="">::</span><span style="">builder_unencrypted_localhost</span><span style="">().</span><span style="">unwrap</span><span style="">().</span><span style="">build</span><span style="">();</span><span style="">
|
SmtpTransport::builder_unencrypted_localhost().unwrap().build();
|
||||||
</span><span style=""></span><span style="color:#75715e">// Send the email
|
<span style="color:#75715e">// Send the email
|
||||||
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">result</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">mailer</span><span style="">.</span><span style="">send</span><span style="">(</span><span style="color:#f92672">&</span><span style="">email</span><span style="">);</span><span style="">
|
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span> result <span style="color:#f92672">=</span> mailer.send(<span style="color:#f92672">&</span>email);
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="">assert</span><span style="color:#f92672">!</span><span style="">(</span><span style="">result</span><span style="">.</span><span style="">is_ok</span><span style="">());</span></code></pre>
|
assert<span style="color:#f92672">!</span>(result.is_ok());</code></pre></div>
|
||||||
</div>
|
|
||||||
<h4 id="complete-example">Complete example</h4>
|
<h4 id="complete-example">Complete example</h4>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">authentication</span><span style="">::</span><span style="">{</span><span style="">Credentials</span><span style="">,</span><span style=""> </span><span style="">Mechanism</span><span style="">};</span><span style="">
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span> lettre::smtp::authentication::{Credentials, Mechanism};
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">SUBMISSION_PORT</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::SUBMISSION_PORT;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">{</span><span style="">SimpleSendableEmail</span><span style="">,</span><span style=""> </span><span style="">EmailTransport</span><span style="">,</span><span style=""> </span><span style="">EmailAddress</span><span style="">,</span><span style=""> </span><span style="">SmtpTransport</span><span style="">};</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::{SimpleSendableEmail, EmailTransport, EmailAddress, SmtpTransport};
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">extension</span><span style="">::</span><span style="">ClientId</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::extension::ClientId;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">ConnectionReuseParameters</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::ConnectionReuseParameters;
|
||||||
</span><span style="">
|
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">email</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SimpleSendableEmail</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> email <span style="color:#f92672">=</span> SimpleSendableEmail::new(
|
||||||
</span><span style=""> </span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">()),</span><span style="">
|
EmailAddress::new(<span style="color:#e6db74">"user@localhost"</span>.to_string()),
|
||||||
</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"root@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">())],</span><span style="">
|
vec<span style="color:#f92672">!</span>[EmailAddress::new(<span style="color:#e6db74">"root@localhost"</span>.to_string())],
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"message_id"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"message_id"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"Hello world"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"Hello world"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#75715e">// Connect to a remote server on a custom port
|
<span style="color:#75715e">// Connect to a remote server on a custom port
|
||||||
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="color:#66d9ef">mut</span><span style=""> </span><span style="">mailer</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SmtpTransport</span><span style="">::</span><span style="">simple_builder</span><span style="">(</span><span style="color:#e6db74">"server.tld"</span><span style="">.</span><span style="">to_string</span><span style="">()).</span><span style="">unwrap</span><span style="">()</span><span style="">
|
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span> <span style="color:#66d9ef">mut</span> mailer <span style="color:#f92672">=</span> SmtpTransport::simple_builder(<span style="color:#e6db74">"server.tld"</span>.to_string()).unwrap()
|
||||||
</span><span style=""> </span><span style="color:#75715e">// Set the name sent during EHLO/HELO, default is `localhost`
|
<span style="color:#75715e">// Set the name sent during EHLO/HELO, default is `localhost`
|
||||||
</span><span style="color:#75715e"></span><span style=""> </span><span style="">.</span><span style="">hello_name</span><span style="">(</span><span style="">ClientId</span><span style="">::</span><span style="">Domain</span><span style="">(</span><span style="color:#e6db74">"my.hostname.tld"</span><span style="">.</span><span style="">to_string</span><span style="">()))</span><span style="">
|
</span><span style="color:#75715e"></span> .hello_name(ClientId::Domain(<span style="color:#e6db74">"my.hostname.tld"</span>.to_string()))
|
||||||
</span><span style=""> </span><span style="color:#75715e">// Add credentials for authentication
|
<span style="color:#75715e">// Add credentials for authentication
|
||||||
</span><span style="color:#75715e"></span><span style=""> </span><span style="">.</span><span style="">credentials</span><span style="">(</span><span style="">Credentials</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"username"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style=""> </span><span style="color:#e6db74">"password"</span><span style="">.</span><span style="">to_string</span><span style="">()))</span><span style="">
|
</span><span style="color:#75715e"></span> .credentials(Credentials::new(<span style="color:#e6db74">"username"</span>.to_string(), <span style="color:#e6db74">"password"</span>.to_string()))
|
||||||
</span><span style=""> </span><span style="color:#75715e">// Enable SMTPUTF8 if the server supports it
|
<span style="color:#75715e">// Enable SMTPUTF8 if the server supports it
|
||||||
</span><span style="color:#75715e"></span><span style=""> </span><span style="">.</span><span style="">smtp_utf8</span><span style="">(</span><span style="color:#66d9ef">true</span><span style="">)</span><span style="">
|
</span><span style="color:#75715e"></span> .smtp_utf8(<span style="color:#66d9ef">true</span>)
|
||||||
</span><span style=""> </span><span style="color:#75715e">// Configure expected authentication mechanism
|
<span style="color:#75715e">// Configure expected authentication mechanism
|
||||||
</span><span style="color:#75715e"></span><span style=""> </span><span style="">.</span><span style="">authentication_mechanism</span><span style="">(</span><span style="">Mechanism</span><span style="">::</span><span style="">Plain</span><span style="">)</span><span style="">
|
</span><span style="color:#75715e"></span> .authentication_mechanism(Mechanism::Plain)
|
||||||
</span><span style=""> </span><span style="color:#75715e">// Enable connection reuse
|
<span style="color:#75715e">// Enable connection reuse
|
||||||
</span><span style="color:#75715e"></span><span style=""> </span><span style="">.</span><span style="">connection_reuse</span><span style="">(</span><span style="">ConnectionReuseParameters</span><span style="">::</span><span style="">ReuseUnlimited</span><span style="">).</span><span style="">build</span><span style="">();</span><span style="">
|
</span><span style="color:#75715e"></span> .connection_reuse(ConnectionReuseParameters::ReuseUnlimited).build();
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">result_1</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">mailer</span><span style="">.</span><span style="">send</span><span style="">(</span><span style="color:#f92672">&</span><span style="">email</span><span style="">);</span><span style="">
|
<span style="color:#66d9ef">let</span> result_1 <span style="color:#f92672">=</span> mailer.send(<span style="color:#f92672">&</span>email);
|
||||||
</span><span style=""></span><span style="">assert</span><span style="color:#f92672">!</span><span style="">(</span><span style="">result_1</span><span style="">.</span><span style="">is_ok</span><span style="">());</span><span style="">
|
assert<span style="color:#f92672">!</span>(result_1.is_ok());
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#75715e">// The second email will use the same connection
|
<span style="color:#75715e">// The second email will use the same connection
|
||||||
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">result_2</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">mailer</span><span style="">.</span><span style="">send</span><span style="">(</span><span style="color:#f92672">&</span><span style="">email</span><span style="">);</span><span style="">
|
</span><span style="color:#75715e"></span><span style="color:#66d9ef">let</span> result_2 <span style="color:#f92672">=</span> mailer.send(<span style="color:#f92672">&</span>email);
|
||||||
</span><span style=""></span><span style="">assert</span><span style="color:#f92672">!</span><span style="">(</span><span style="">result_2</span><span style="">.</span><span style="">is_ok</span><span style="">());</span><span style="">
|
assert<span style="color:#f92672">!</span>(result_2.is_ok());
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#75715e">// Explicitly close the SMTP transaction as we enabled connection reuse
|
<span style="color:#75715e">// Explicitly close the SMTP transaction as we enabled connection reuse
|
||||||
</span><span style="color:#75715e"></span><span style="">mailer</span><span style="">.</span><span style="">close</span><span style="">();</span></code></pre>
|
</span><span style="color:#75715e"></span>mailer.close();</code></pre></div>
|
||||||
</div>
|
|
||||||
<h4 id="lower-level">Lower level</h4>
|
<h4 id="lower-level">Lower level</h4>
|
||||||
|
|
||||||
<p>You can also send commands, here is a simple email transaction without
|
<p>You can also send commands, here is a simple email transaction without
|
||||||
error handling:</p>
|
error handling:</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">EmailAddress</span><span style="">;</span><span style="">
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span> lettre::EmailAddress;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">SMTP_PORT</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::SMTP_PORT;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">client</span><span style="">::</span><span style="">Client</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::client::Client;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">client</span><span style="">::</span><span style="">net</span><span style="">::</span><span style="">NetworkStream</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::client::net::NetworkStream;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">extension</span><span style="">::</span><span style="">ClientId</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::extension::ClientId;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">smtp</span><span style="">::</span><span style="">commands</span><span style="">::</span><span style="color:#f92672">*</span><span style="">;</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::smtp::commands::<span style="color:#f92672">*</span>;
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="color:#66d9ef">mut</span><span style=""> </span><span style="">email_client</span><span style="">: </span><span style="color:#a6e22e">Client</span><span style="color:#f92672"><</span><span style="">NetworkStream</span><span style="color:#f92672">></span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">Client</span><span style="">::</span><span style="">new</span><span style="">();</span><span style="">
|
<span style="color:#66d9ef">let</span> <span style="color:#66d9ef">mut</span> email_client: <span style="color:#a6e22e">Client</span><span style="color:#f92672"><</span>NetworkStream<span style="color:#f92672">></span> <span style="color:#f92672">=</span> Client::new();
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">connect</span><span style="">(</span><span style="color:#f92672">&</span><span style="">(</span><span style="color:#e6db74">"localhost"</span><span style="">,</span><span style=""> </span><span style="">SMTP_PORT</span><span style="">),</span><span style=""> </span><span style="">None</span><span style="">);</span><span style="">
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.connect(<span style="color:#f92672">&</span>(<span style="color:#e6db74">"localhost"</span>, SMTP_PORT), None);
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">smtp_command</span><span style="">(</span><span style="">EhloCommand</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">ClientId</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"my_hostname"</span><span style="">.</span><span style="">to_string</span><span style="">())));</span><span style="">
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.command(EhloCommand::new(ClientId::new(<span style="color:#e6db74">"my_hostname"</span>.to_string())));
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">smtp_command</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.command(
|
||||||
</span><span style=""> </span><span style="">MailCommand</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">Some</span><span style="">(</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@example.com"</span><span style="">.</span><span style="">to_string</span><span style="">())),</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[])</span><span style="">
|
MailCommand::new(Some(EmailAddress::new(<span style="color:#e6db74">"user@example.com"</span>.to_string())), vec<span style="color:#f92672">!</span>[])
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">smtp_command</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.command(
|
||||||
</span><span style=""> </span><span style="">RcptCommand</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@example.org"</span><span style="">.</span><span style="">to_string</span><span style="">()),</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[])</span><span style="">
|
RcptCommand::new(EmailAddress::new(<span style="color:#e6db74">"user@example.org"</span>.to_string()), vec<span style="color:#f92672">!</span>[])
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">smtp_command</span><span style="">(</span><span style="">DataCommand</span><span style="">);</span><span style="">
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.command(DataCommand);
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">message</span><span style="">(</span><span style="">Box</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"Test email"</span><span style="">.</span><span style="">as_bytes</span><span style="">()));</span><span style="">
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.message(Box::new(<span style="color:#e6db74">"Test email"</span>.as_bytes()));
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">_</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">email_client</span><span style="">.</span><span style="">smtp_command</span><span style="">(</span><span style="">QuitCommand</span><span style="">);</span></code></pre>
|
<span style="color:#66d9ef">let</span> _ <span style="color:#f92672">=</span> email_client.command(QuitCommand);</code></pre></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class=" footline" >
|
<footer class=" footline" >
|
||||||
|
|
||||||
@@ -672,20 +669,20 @@ error handling:</p>
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="generator" content="Hugo 0.29" />
|
<meta name="generator" content="Hugo 0.32.4" />
|
||||||
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
<meta name="description" content="Documentation for the Lettre mailer in Rust">
|
||||||
<meta name="author" content="Alexis Mousset">
|
<meta name="author" content="Alexis Mousset">
|
||||||
|
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
<title>Stub transport :: Lettre site</title>
|
<title>Stub transport :: Lettre site</title>
|
||||||
|
|
||||||
|
|
||||||
<link href="/lettre/css/nucleus.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/nucleus.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/font-awesome.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/font-awesome.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hybrid.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hybrid.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/featherlight.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/featherlight.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/perfect-scrollbar.min.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/perfect-scrollbar.min.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/auto-complete.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/auto-complete.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/theme.css?1516041983" rel="stylesheet">
|
||||||
<link href="/lettre/css/hugo-theme.css?1508105428" rel="stylesheet">
|
<link href="/lettre/css/hugo-theme.css?1516041983" rel="stylesheet">
|
||||||
|
|
||||||
|
|
||||||
<script src="/lettre/js/jquery-2.x.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery-2.x.min.js?1516041983"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root #header + #content > #left > #rlblock_left{
|
:root #header + #content > #left > #rlblock_left{
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
<span data-search-clear=""><i class="fa fa-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/lettre/js/lunr.min.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/lunr.min.js?1516041983"></script>
|
||||||
<script type="text/javascript" src="/lettre/js/auto-complete.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/auto-complete.js?1516041983"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
var baseurl = "https:\/\/lettre.github.io\/lettre";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/lettre/js/search.js?1508105428"></script>
|
<script type="text/javascript" src="/lettre/js/search.js?1516041983"></script>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -356,23 +356,21 @@
|
|||||||
|
|
||||||
<p>The stub transport only logs message envelope and drops the content. It can be useful for
|
<p>The stub transport only logs message envelope and drops the content. It can be useful for
|
||||||
testing purposes.</p>
|
testing purposes.</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">stub</span><span style="">::</span><span style="">StubEmailTransport</span><span style="">;</span><span style="">
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-rust" data-lang="rust"><span style="color:#66d9ef">use</span> lettre::stub::StubEmailTransport;
|
||||||
</span><span style=""></span><span style="color:#66d9ef">use</span><span style=""> </span><span style="">lettre</span><span style="">::</span><span style="">{</span><span style="">SimpleSendableEmail</span><span style="">,</span><span style=""> </span><span style="">EmailTransport</span><span style="">,</span><span style=""> </span><span style="">EmailAddress</span><span style="">};</span><span style="">
|
<span style="color:#66d9ef">use</span> lettre::{SimpleSendableEmail, EmailTransport, EmailAddress};
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">email</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">SimpleSendableEmail</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="">
|
<span style="color:#66d9ef">let</span> email <span style="color:#f92672">=</span> SimpleSendableEmail::new(
|
||||||
</span><span style=""> </span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"user@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">()),</span><span style="">
|
EmailAddress::new(<span style="color:#e6db74">"user@localhost"</span>.to_string()),
|
||||||
</span><span style=""> </span><span style="">vec</span><span style="color:#f92672">!</span><span style="">[</span><span style="">EmailAddress</span><span style="">::</span><span style="">new</span><span style="">(</span><span style="color:#e6db74">"root@localhost"</span><span style="">.</span><span style="">to_string</span><span style="">())],</span><span style="">
|
vec<span style="color:#f92672">!</span>[EmailAddress::new(<span style="color:#e6db74">"root@localhost"</span>.to_string())],
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"message_id"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"message_id"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="color:#e6db74">"Hello world"</span><span style="">.</span><span style="">to_string</span><span style="">(),</span><span style="">
|
<span style="color:#e6db74">"Hello world"</span>.to_string(),
|
||||||
</span><span style=""> </span><span style="">);</span><span style="">
|
);
|
||||||
</span><span style="">
|
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="color:#66d9ef">mut</span><span style=""> </span><span style="">sender</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">StubEmailTransport</span><span style="">::</span><span style="">new_positive</span><span style="">();</span><span style="">
|
<span style="color:#66d9ef">let</span> <span style="color:#66d9ef">mut</span> sender <span style="color:#f92672">=</span> StubEmailTransport::new_positive();
|
||||||
</span><span style=""></span><span style="color:#66d9ef">let</span><span style=""> </span><span style="">result</span><span style=""> </span><span style="color:#f92672">=</span><span style=""> </span><span style="">sender</span><span style="">.</span><span style="">send</span><span style="">(</span><span style="color:#f92672">&</span><span style="">email</span><span style="">);</span><span style="">
|
<span style="color:#66d9ef">let</span> result <span style="color:#f92672">=</span> sender.send(<span style="color:#f92672">&</span>email);
|
||||||
</span><span style=""></span><span style="">assert</span><span style="color:#f92672">!</span><span style="">(</span><span style="">result</span><span style="">.</span><span style="">is_ok</span><span style="">());</span></code></pre>
|
assert<span style="color:#f92672">!</span>(result.is_ok());</code></pre></div>
|
||||||
</div>
|
|
||||||
<p>Will log (when using a logger like <code>env_logger</code>):</p>
|
<p>Will log (when using a logger like <code>env_logger</code>):</p>
|
||||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text"><span style="">b7c211bc-9811-45ce-8cd9-68eab575d695: from=<user@localhost> to=<root@localhost></span></code></pre>
|
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">b7c211bc-9811-45ce-8cd9-68eab575d695: from=<user@localhost> to=<root@localhost></code></pre></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class=" footline" >
|
<footer class=" footline" >
|
||||||
|
|
||||||
@@ -574,20 +572,20 @@ testing purposes.</p>
|
|||||||
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
|
||||||
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/lettre/js/clipboard.min.js?1508105428"></script>
|
<script src="/lettre/js/clipboard.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1508105428"></script>
|
<script src="/lettre/js/perfect-scrollbar.jquery.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/jquery.sticky-kit.min.js?1508105428"></script>
|
<script src="/lettre/js/jquery.sticky-kit.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/featherlight.min.js?1508105428"></script>
|
<script src="/lettre/js/featherlight.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/html5shiv-printshiv.min.js?1508105428"></script>
|
<script src="/lettre/js/html5shiv-printshiv.min.js?1516041983"></script>
|
||||||
<script src="/lettre/js/highlight.pack.js?1508105428"></script>
|
<script src="/lettre/js/highlight.pack.js?1516041983"></script>
|
||||||
<script>hljs.initHighlightingOnLoad();</script>
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
<script src="/lettre/js/modernizr.custom.71422.js?1508105428"></script>
|
<script src="/lettre/js/modernizr.custom.71422.js?1516041983"></script>
|
||||||
<script src="/lettre/js/learn.js?1508105428"></script>
|
<script src="/lettre/js/learn.js?1516041983"></script>
|
||||||
<script src="/lettre/js/hugo-learn.js?1508105428"></script>
|
<script src="/lettre/js/hugo-learn.js?1516041983"></script>
|
||||||
|
|
||||||
<link href="/lettre/mermaid/mermaid.css?1508105428" type="text/css" rel="stylesheet" />
|
<link href="/lettre/mermaid/mermaid.css?1516041983" type="text/css" rel="stylesheet" />
|
||||||
<script src="/lettre/mermaid/mermaid.js?1508105428"></script>
|
<script src="/lettre/mermaid/mermaid.js?1516041983"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ fn bench_simple_send(b: &mut test::Bencher) {
|
|||||||
.build();
|
.build();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let email =
|
let email =
|
||||||
SimpleSendableEmail::new(EmailAddress::new("user@localhost".to_string()),
|
SimpleSendableEmail::new(EmailAddress::new("user@localhost".to_string()),
|
||||||
vec![EmailAddress::new("root@localhost".to_string())],
|
vec![EmailAddress::new("root@localhost".to_string())],
|
||||||
"id".to_string(),
|
"id".to_string(),
|
||||||
"Hello world".to_string());
|
"Hello world".to_string());
|
||||||
let result = sender.send(&email);
|
let result = sender.send(&email);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
});
|
});
|
||||||
@@ -30,10 +30,10 @@ fn bench_reuse_send(b: &mut test::Bencher) {
|
|||||||
.build();
|
.build();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let email =
|
let email =
|
||||||
SimpleSendableEmail::new(EmailAddress::new("user@localhost".to_string()),
|
SimpleSendableEmail::new(EmailAddress::new("user@localhost".to_string()),
|
||||||
vec![EmailAddress::new("root@localhost".to_string())],
|
vec![EmailAddress::new("root@localhost".to_string())],
|
||||||
"id".to_string(),
|
"id".to_string(),
|
||||||
"Hello world".to_string());
|
"Hello world".to_string());
|
||||||
let result = sender.send(&email);
|
let result = sender.send(&email);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ pub const DEFAULT_UNENCRYPTED_MECHANISMS: &[Mechanism] = &[Mechanism::CramMd5];
|
|||||||
#[cfg(not(feature = "crammd5-auth"))]
|
#[cfg(not(feature = "crammd5-auth"))]
|
||||||
pub const DEFAULT_UNENCRYPTED_MECHANISMS: &[Mechanism] = &[];
|
pub const DEFAULT_UNENCRYPTED_MECHANISMS: &[Mechanism] = &[];
|
||||||
|
|
||||||
|
|
||||||
/// Convertable to user credentials
|
/// Convertable to user credentials
|
||||||
pub trait IntoCredentials {
|
pub trait IntoCredentials {
|
||||||
/// Converts to a `Credentials` struct
|
/// Converts to a `Credentials` struct
|
||||||
@@ -111,18 +110,14 @@ impl Mechanism {
|
|||||||
challenge: Option<&str>)
|
challenge: Option<&str>)
|
||||||
-> Result<String, Error> {
|
-> Result<String, Error> {
|
||||||
match *self {
|
match *self {
|
||||||
Mechanism::Plain => {
|
Mechanism::Plain => match challenge {
|
||||||
match challenge {
|
Some(_) => Err(Error::Client("This mechanism does not expect a challenge")),
|
||||||
Some(_) => Err(Error::Client("This mechanism does not expect a challenge")),
|
None => Ok(format!("{}{}{}{}",
|
||||||
None => {
|
|
||||||
Ok(format!("{}{}{}{}",
|
|
||||||
NUL,
|
NUL,
|
||||||
credentials.username,
|
credentials.username,
|
||||||
NUL,
|
NUL,
|
||||||
credentials.password))
|
credentials.password)),
|
||||||
}
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
Mechanism::Login => {
|
Mechanism::Login => {
|
||||||
let decoded_challenge = match challenge {
|
let decoded_challenge = match challenge {
|
||||||
Some(challenge) => challenge,
|
Some(challenge) => challenge,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ use std::net::ToSocketAddrs;
|
|||||||
use std::string::String;
|
use std::string::String;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|
||||||
pub mod net;
|
pub mod net;
|
||||||
pub mod mock;
|
pub mod mock;
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,11 @@ impl NetworkStream {
|
|||||||
match *self {
|
match *self {
|
||||||
NetworkStream::Tcp(ref s) => s.peer_addr(),
|
NetworkStream::Tcp(ref s) => s.peer_addr(),
|
||||||
NetworkStream::Tls(ref s) => s.get_ref().peer_addr(),
|
NetworkStream::Tls(ref s) => s.get_ref().peer_addr(),
|
||||||
NetworkStream::Mock(_) => {
|
NetworkStream::Mock(_) => Ok(SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127,
|
||||||
Ok(SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 80)))
|
0,
|
||||||
}
|
0,
|
||||||
|
1),
|
||||||
|
80))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,12 +108,10 @@ impl Connector for NetworkStream {
|
|||||||
let tcp_stream = TcpStream::connect(addr)?;
|
let tcp_stream = TcpStream::connect(addr)?;
|
||||||
|
|
||||||
match tls_parameters {
|
match tls_parameters {
|
||||||
Some(context) => {
|
Some(context) => context.connector
|
||||||
context.connector
|
.connect(context.domain.as_ref(), tcp_stream)
|
||||||
.connect(context.domain.as_ref(), tcp_stream)
|
.map(NetworkStream::Tls)
|
||||||
.map(NetworkStream::Tls)
|
.map_err(|e| io::Error::new(ErrorKind::Other, e)),
|
||||||
.map_err(|e| io::Error::new(ErrorKind::Other, e))
|
|
||||||
}
|
|
||||||
None => Ok(NetworkStream::Tcp(tcp_stream)),
|
None => Ok(NetworkStream::Tcp(tcp_stream)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,9 +243,9 @@ impl AuthCommand {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
Ok(AuthCommand { mechanism: mechanism,
|
Ok(AuthCommand { mechanism: mechanism,
|
||||||
credentials: credentials,
|
credentials: credentials,
|
||||||
challenge: challenge,
|
challenge: challenge,
|
||||||
response: response, })
|
response: response, })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates an AUTH command from a response that needs to be a
|
/// Creates an AUTH command from a response that needs to be a
|
||||||
@@ -266,12 +266,10 @@ impl AuthCommand {
|
|||||||
debug!("auth encoded challenge: {}", encoded_challenge);
|
debug!("auth encoded challenge: {}", encoded_challenge);
|
||||||
|
|
||||||
let decoded_challenge = match base64::decode(&encoded_challenge) {
|
let decoded_challenge = match base64::decode(&encoded_challenge) {
|
||||||
Ok(challenge) => {
|
Ok(challenge) => match String::from_utf8(challenge) {
|
||||||
match String::from_utf8(challenge) {
|
Ok(value) => value,
|
||||||
Ok(value) => value,
|
Err(error) => return Err(Error::Utf8Parsing(error)),
|
||||||
Err(error) => return Err(Error::Utf8Parsing(error)),
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(error) => return Err(Error::ChallengeParsing(error)),
|
Err(error) => return Err(Error::ChallengeParsing(error)),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -280,9 +278,9 @@ impl AuthCommand {
|
|||||||
let response = Some(mechanism.response(&credentials, Some(decoded_challenge.as_ref()))?);
|
let response = Some(mechanism.response(&credentials, Some(decoded_challenge.as_ref()))?);
|
||||||
|
|
||||||
Ok(AuthCommand { mechanism: mechanism,
|
Ok(AuthCommand { mechanism: mechanism,
|
||||||
credentials: credentials,
|
credentials: credentials,
|
||||||
challenge: Some(decoded_challenge),
|
challenge: Some(decoded_challenge),
|
||||||
response: response, })
|
response: response, })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,18 +52,14 @@ impl StdError for Error {
|
|||||||
match *self {
|
match *self {
|
||||||
// Try to display the first line of the server's response that usually
|
// Try to display the first line of the server's response that usually
|
||||||
// contains a short humanly readable error message
|
// contains a short humanly readable error message
|
||||||
Transient(ref err) => {
|
Transient(ref err) => match err.first_line() {
|
||||||
match err.first_line() {
|
Some(line) => line,
|
||||||
Some(line) => line,
|
None => "undetailed transient error during SMTP transaction",
|
||||||
None => "undetailed transient error during SMTP transaction",
|
},
|
||||||
}
|
Permanent(ref err) => match err.first_line() {
|
||||||
}
|
Some(line) => line,
|
||||||
Permanent(ref err) => {
|
None => "undetailed permanent error during SMTP transaction",
|
||||||
match err.first_line() {
|
},
|
||||||
Some(line) => line,
|
|
||||||
None => "undetailed permanent error during SMTP transaction",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ResponseParsing(err) => err,
|
ResponseParsing(err) => err,
|
||||||
ChallengeParsing(ref err) => err.description(),
|
ChallengeParsing(ref err) => err.description(),
|
||||||
Utf8Parsing(ref err) => err.description(),
|
Utf8Parsing(ref err) => err.description(),
|
||||||
|
|||||||
@@ -132,29 +132,27 @@ impl ServerInfo {
|
|||||||
"STARTTLS" => {
|
"STARTTLS" => {
|
||||||
features.insert(Extension::StartTls);
|
features.insert(Extension::StartTls);
|
||||||
}
|
}
|
||||||
"AUTH" => {
|
"AUTH" => for &mechanism in &splitted[1..] {
|
||||||
for &mechanism in &splitted[1..] {
|
match mechanism {
|
||||||
match mechanism {
|
"PLAIN" => {
|
||||||
"PLAIN" => {
|
features.insert(Extension::Authentication(Mechanism::Plain));
|
||||||
features.insert(Extension::Authentication(Mechanism::Plain));
|
|
||||||
}
|
|
||||||
"LOGIN" => {
|
|
||||||
features.insert(Extension::Authentication(Mechanism::Login));
|
|
||||||
}
|
|
||||||
#[cfg(feature = "crammd5-auth")]
|
|
||||||
"CRAM-MD5" => {
|
|
||||||
features.insert(Extension::Authentication(Mechanism::CramMd5));
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
"LOGIN" => {
|
||||||
|
features.insert(Extension::Authentication(Mechanism::Login));
|
||||||
|
}
|
||||||
|
#[cfg(feature = "crammd5-auth")]
|
||||||
|
"CRAM-MD5" => {
|
||||||
|
features.insert(Extension::Authentication(Mechanism::CramMd5));
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ServerInfo { name: name.to_string(),
|
Ok(ServerInfo { name: name.to_string(),
|
||||||
features: features, })
|
features: features, })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the server supports an ESMTP feature
|
/// Checks if the server supports an ESMTP feature
|
||||||
@@ -248,7 +246,7 @@ impl Display for RcptParameter {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
||||||
use super::{Extension, ServerInfo, ClientId};
|
use super::{ClientId, Extension, ServerInfo};
|
||||||
use smtp::authentication::Mechanism;
|
use smtp::authentication::Mechanism;
|
||||||
use smtp::response::{Category, Code, Detail, Response, Severity};
|
use smtp::response::{Category, Code, Detail, Response, Severity};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|||||||
@@ -215,16 +215,14 @@ impl SmtpTransportBuilder {
|
|||||||
let mut addresses = addr.to_socket_addrs()?;
|
let mut addresses = addr.to_socket_addrs()?;
|
||||||
|
|
||||||
match addresses.next() {
|
match addresses.next() {
|
||||||
Some(addr) => {
|
Some(addr) => Ok(SmtpTransportBuilder { server_addr: addr,
|
||||||
Ok(SmtpTransportBuilder { server_addr: addr,
|
security: security,
|
||||||
security: security,
|
smtp_utf8: false,
|
||||||
smtp_utf8: false,
|
credentials: None,
|
||||||
credentials: None,
|
connection_reuse: ConnectionReuseParameters::NoReuse,
|
||||||
connection_reuse: ConnectionReuseParameters::NoReuse,
|
hello_name: ClientId::hostname(),
|
||||||
hello_name: ClientId::hostname(),
|
authentication_mechanism: None,
|
||||||
authentication_mechanism: None,
|
timeout: Some(Duration::new(60, 0)), }),
|
||||||
timeout: Some(Duration::new(60, 0)), })
|
|
||||||
}
|
|
||||||
None => Err(Error::Resolution),
|
None => Err(Error::Resolution),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -451,7 +449,8 @@ impl<'a, T: Read + 'a> EmailTransport<'a, T, SmtpResult> for SmtpTransport {
|
|||||||
for mechanism in accepted_mechanisms {
|
for mechanism in accepted_mechanisms {
|
||||||
if self.server_info.as_ref()
|
if self.server_info.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.supports_auth_mechanism(mechanism) {
|
.supports_auth_mechanism(mechanism)
|
||||||
|
{
|
||||||
found = true;
|
found = true;
|
||||||
try_smtp!(
|
try_smtp!(
|
||||||
self.client
|
self.client
|
||||||
@@ -473,13 +472,15 @@ impl<'a, T: Read + 'a> EmailTransport<'a, T, SmtpResult> for SmtpTransport {
|
|||||||
|
|
||||||
if self.server_info.as_ref()
|
if self.server_info.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.supports_feature(Extension::EightBitMime) {
|
.supports_feature(Extension::EightBitMime)
|
||||||
|
{
|
||||||
mail_options.push(MailParameter::Body(MailBodyParameter::EightBitMime));
|
mail_options.push(MailParameter::Body(MailBodyParameter::EightBitMime));
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.server_info.as_ref()
|
if self.server_info.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.supports_feature(Extension::SmtpUtfEight) && self.client_info.smtp_utf8 {
|
.supports_feature(Extension::SmtpUtfEight) && self.client_info.smtp_utf8
|
||||||
|
{
|
||||||
mail_options.push(MailParameter::SmtpUtfEight);
|
mail_options.push(MailParameter::SmtpUtfEight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,26 +53,16 @@ impl Display for Category {
|
|||||||
/// The detail digit of a response code (third digit)
|
/// The detail digit of a response code (third digit)
|
||||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||||
pub enum Detail {
|
pub enum Detail {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)] Zero = 0,
|
||||||
Zero = 0,
|
#[allow(missing_docs)] One = 1,
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)] Two = 2,
|
||||||
One = 1,
|
#[allow(missing_docs)] Three = 3,
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)] Four = 4,
|
||||||
Two = 2,
|
#[allow(missing_docs)] Five = 5,
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)] Six = 6,
|
||||||
Three = 3,
|
#[allow(missing_docs)] Seven = 7,
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)] Eight = 8,
|
||||||
Four = 4,
|
#[allow(missing_docs)] Nine = 9,
|
||||||
#[allow(missing_docs)]
|
|
||||||
Five = 5,
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
Six = 6,
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
Seven = 7,
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
Eight = 8,
|
|
||||||
#[allow(missing_docs)]
|
|
||||||
Nine = 9,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Detail {
|
impl Display for Detail {
|
||||||
@@ -167,11 +157,9 @@ impl Response {
|
|||||||
|
|
||||||
named!(parse_code<Code>,
|
named!(parse_code<Code>,
|
||||||
map!(tuple!(parse_severity, parse_category, parse_detail),
|
map!(tuple!(parse_severity, parse_category, parse_detail),
|
||||||
|(severity, category, detail)| {
|
|(severity, category, detail)| Code { severity: severity,
|
||||||
Code { severity: severity,
|
category: category,
|
||||||
category: category,
|
detail: detail, }));
|
||||||
detail: detail, }
|
|
||||||
}));
|
|
||||||
|
|
||||||
named!(
|
named!(
|
||||||
parse_severity<Severity>,
|
parse_severity<Severity>,
|
||||||
@@ -234,10 +222,10 @@ named!(parse_response<Response>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(Response { code: last_code,
|
Ok(Response { code: last_code,
|
||||||
message: lines.into_iter()
|
message: lines.into_iter()
|
||||||
.map(|line| from_utf8(line).map(|s| s.to_string()))
|
.map(|line| from_utf8(line).map(|s| s.to_string()))
|
||||||
.collect::<result::Result<Vec<_>, _>>()
|
.collect::<result::Result<Vec<_>, _>>()
|
||||||
.map_err(|_| ())?, })
|
.map_err(|_| ())?, })
|
||||||
}));
|
}));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ impl<'a> Display for XText<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::XText;
|
use super::XText;
|
||||||
@@ -37,7 +36,8 @@ mod tests {
|
|||||||
for (input, expect) in vec![("bjorn", "bjorn"),
|
for (input, expect) in vec![("bjorn", "bjorn"),
|
||||||
("bjørn", "bjørn"),
|
("bjørn", "bjørn"),
|
||||||
("Ø+= ❤️‰", "Ø+2B+3D+20❤️‰"),
|
("Ø+= ❤️‰", "Ø+2B+3D+20❤️‰"),
|
||||||
("+", "+2B")] {
|
("+", "+2B")]
|
||||||
|
{
|
||||||
assert_eq!(format!("{}", XText(input)), expect);
|
assert_eq!(format!("{}", XText(input)), expect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ impl IntoEmail for SimpleEmail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Simple representation of an email, useful for some transports
|
/// Simple representation of an email, useful for some transports
|
||||||
#[derive(PartialEq, Eq, Clone, Debug, Default)]
|
#[derive(PartialEq, Eq, Clone, Debug, Default)]
|
||||||
pub struct SimpleEmail {
|
pub struct SimpleEmail {
|
||||||
@@ -323,7 +322,6 @@ impl Default for PartBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Builds an `Email` structure
|
/// Builds an `Email` structure
|
||||||
#[derive(PartialEq, Eq, Clone, Debug, Default)]
|
#[derive(PartialEq, Eq, Clone, Debug, Default)]
|
||||||
pub struct EmailBuilder {
|
pub struct EmailBuilder {
|
||||||
@@ -628,17 +626,13 @@ impl EmailBuilder {
|
|||||||
|
|
||||||
let actual_filename = match filename {
|
let actual_filename = match filename {
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
None => {
|
None => match path.file_name() {
|
||||||
match path.file_name() {
|
Some(name) => match name.to_str() {
|
||||||
Some(name) => {
|
Some(name) => name,
|
||||||
match name.to_str() {
|
|
||||||
Some(name) => name,
|
|
||||||
None => return Err(Error::CannotParseFilename),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => return Err(Error::CannotParseFilename),
|
None => return Err(Error::CannotParseFilename),
|
||||||
}
|
},
|
||||||
}
|
None => return Err(Error::CannotParseFilename),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let content = PartBuilder::new().body(body)
|
let content = PartBuilder::new().body(body)
|
||||||
@@ -778,14 +772,13 @@ impl EmailBuilder {
|
|||||||
// add all receivers in to_header and cc_header
|
// add all receivers in to_header and cc_header
|
||||||
for receiver in self.to_header.iter()
|
for receiver in self.to_header.iter()
|
||||||
.chain(self.cc_header.iter())
|
.chain(self.cc_header.iter())
|
||||||
.chain(self.bcc_header.iter()) {
|
.chain(self.bcc_header.iter())
|
||||||
|
{
|
||||||
match *receiver {
|
match *receiver {
|
||||||
Address::Mailbox(ref m) => e.add_to(m.address.clone()),
|
Address::Mailbox(ref m) => e.add_to(m.address.clone()),
|
||||||
Address::Group(_, ref ms) => {
|
Address::Group(_, ref ms) => for m in ms.iter() {
|
||||||
for m in ms.iter() {
|
e.add_to(m.address.clone());
|
||||||
e.add_to(m.address.clone());
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if e.to.is_empty() {
|
if e.to.is_empty() {
|
||||||
@@ -844,7 +837,8 @@ impl EmailBuilder {
|
|||||||
let message_id = Uuid::new_v4();
|
let message_id = Uuid::new_v4();
|
||||||
|
|
||||||
if let Ok(header) = Header::new_with_value("Message-ID".to_string(),
|
if let Ok(header) = Header::new_with_value("Message-ID".to_string(),
|
||||||
format!("<{}.lettre@localhost>", message_id)) {
|
format!("<{}.lettre@localhost>", message_id))
|
||||||
|
{
|
||||||
self.message.add_header(header)
|
self.message.add_header(header)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,7 +893,6 @@ pub trait ExtractableEmail {
|
|||||||
fn text(self) -> String;
|
fn text(self) -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ reorder_imported_names = true
|
|||||||
reorder_imports_in_group = true
|
reorder_imports_in_group = true
|
||||||
struct_field_align_threshold = 20
|
struct_field_align_threshold = 20
|
||||||
indent_style = "Visual"
|
indent_style = "Visual"
|
||||||
chain_indent = "Visual"
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
hugo
|
hugo
|
||||||
lunr-hugo -i "content/**/*.md" -o ../docs/json/search.json -l toml
|
lunr-hugo -i "content/**/*.md" -o ../docs/index.json -l toml
|
||||||
|
|||||||
@@ -7,3 +7,6 @@ weight = 2
|
|||||||
+++
|
+++
|
||||||
|
|
||||||
### Creating messages
|
### Creating messages
|
||||||
|
|
||||||
|
The documentation for the `lettre_email` is available on https://docs.rs/lettre_email/0.7.0/lettre_email/ for now.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user