pub struct Email { /* private fields */ }
Implementations§
Source§impl Email
impl Email
Sourcepub fn builder() -> Self
pub fn builder() -> Self
Examples found in repository?
examples/simple.rs (line 10)
4async fn main() -> Result<()> {
5 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
6 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
7
8 Templateless::new(&api_key)
9 .send(
10 Email::builder()
11 .to(EmailAddress::new(&email_address))
12 .subject("Hello 👋")
13 .content(Content::builder().text("Hello world").build()?)
14 .build()?,
15 )
16 .await?;
17
18 Ok(())
19}
More examples
examples/feedback.rs (line 41)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .socials(&[
23 SocialItem::new(Service::Twitter, "MyCo"),
24 SocialItem::new(Service::GitHub, "MyCo"),
25 ])
26 .build()?;
27
28 let content = Content::builder()
29 .theme(Theme::Simple)
30 .header(header)
31 .text("Hey Alex,")
32 .text("I'm Jamie, founder of **MyCo**.")
33 .text("Could you spare a moment to reply to this email with your thoughts on our service? Your feedback is invaluable and directly influences our improvements.")
34 .text("When you hit reply, your email will go directly to me, and I read each and every one.")
35 .text("Thanks for your support,")
36 .signature("Jamie Parker")
37 .text("Jamie Parker\n\nFounder @ [MyCo](https://example.com)")
38 .footer(footer)
39 .build()?;
40
41 let email = Email::builder()
42 .to(EmailAddress::new(&email_address))
43 .subject("Confirm your email")
44 .content(content)
45 .build()?;
46
47 let templateless = Templateless::new(&api_key);
48 let _ = templateless.send(email).await?;
49
50 Ok(())
51}
examples/verification.rs (line 44)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .text("If you did not sign up for a MyCo account, please ignore this email.\nThis link will expire in 24 hours.")
23 .socials(&[
24 SocialItem::new(Service::Twitter, "MyCo"),
25 SocialItem::new(Service::GitHub, "MyCo"),
26 ])
27 .link("Unsubscribe", "https://example.com")
28 .build()?;
29
30 let verify_email_link = "https://example.com/verify?token=ABC";
31
32 let content = Content::builder()
33 .theme(Theme::Simple)
34 .header(header)
35 .text("Hi there,")
36 .text("Welcome to **MyCo**! We're excited to have you on board. Before we get started, we need to verify your email address.")
37 .text("Please confirm your email by clicking the button below:")
38 .button("Verify Email", verify_email_link)
39 .text("Or use the link below:")
40 .link(verify_email_link, verify_email_link)
41 .footer(footer)
42 .build()?;
43
44 let email = Email::builder()
45 .to(EmailAddress::new(&email_address))
46 .subject("Confirm your email")
47 .content(content)
48 .build()?;
49
50 let templateless = Templateless::new(&api_key);
51 let _ = templateless.send(email).await?;
52
53 Ok(())
54}
examples/qr_code.rs (line 52)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let app_store_link = "https://apps.apple.com/us/app/example/id1234567890";
22 let google_play_link =
23 "https://play.google.com/store/apps/details?id=com.example";
24
25 let footer = Footer::builder()
26 .store_badges(&[
27 StoreBadgeItem::new(StoreBadge::AppStore, app_store_link),
28 StoreBadgeItem::new(StoreBadge::GooglePlay, google_play_link),
29 ])
30 .socials(&[
31 SocialItem::new(Service::Twitter, "MyCo"),
32 SocialItem::new(Service::GitHub, "MyCo"),
33 ])
34 .build()?;
35
36 let content = Content::builder()
37 .theme(Theme::Simple)
38 .header(header)
39 .text("Hey Alex,")
40 .text("Thank you for choosing MyCo! To get started with our mobile experience, simply pair your account with our mobile app.")
41 .text("Here's how to do it:")
42 .text(&[
43 &format!("1. Download the MyCo app from the [App Store]({app_store_link}) or [Google Play]({google_play_link})."),
44 "1. Open the app and select _Pair Device_.",
45 "1. Scan the QR code below with your mobile device:",
46 ].join("\n"))
47 .qr_code("https://example.com/qr-code-link")
48 .text("Enjoy your seamless experience across devices!")
49 .footer(footer)
50 .build()?;
51
52 let email = Email::builder()
53 .to(EmailAddress::new(&email_address))
54 .subject("How to Pair Device")
55 .content(content)
56 .build()?;
57
58 let templateless = Templateless::new(&api_key);
59 let _ = templateless.send(email).await?;
60
61 Ok(())
62}
Sourcepub fn to(self, email_address: EmailAddress) -> Self
pub fn to(self, email_address: EmailAddress) -> Self
Examples found in repository?
examples/simple.rs (line 11)
4async fn main() -> Result<()> {
5 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
6 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
7
8 Templateless::new(&api_key)
9 .send(
10 Email::builder()
11 .to(EmailAddress::new(&email_address))
12 .subject("Hello 👋")
13 .content(Content::builder().text("Hello world").build()?)
14 .build()?,
15 )
16 .await?;
17
18 Ok(())
19}
More examples
examples/feedback.rs (line 42)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .socials(&[
23 SocialItem::new(Service::Twitter, "MyCo"),
24 SocialItem::new(Service::GitHub, "MyCo"),
25 ])
26 .build()?;
27
28 let content = Content::builder()
29 .theme(Theme::Simple)
30 .header(header)
31 .text("Hey Alex,")
32 .text("I'm Jamie, founder of **MyCo**.")
33 .text("Could you spare a moment to reply to this email with your thoughts on our service? Your feedback is invaluable and directly influences our improvements.")
34 .text("When you hit reply, your email will go directly to me, and I read each and every one.")
35 .text("Thanks for your support,")
36 .signature("Jamie Parker")
37 .text("Jamie Parker\n\nFounder @ [MyCo](https://example.com)")
38 .footer(footer)
39 .build()?;
40
41 let email = Email::builder()
42 .to(EmailAddress::new(&email_address))
43 .subject("Confirm your email")
44 .content(content)
45 .build()?;
46
47 let templateless = Templateless::new(&api_key);
48 let _ = templateless.send(email).await?;
49
50 Ok(())
51}
examples/verification.rs (line 45)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .text("If you did not sign up for a MyCo account, please ignore this email.\nThis link will expire in 24 hours.")
23 .socials(&[
24 SocialItem::new(Service::Twitter, "MyCo"),
25 SocialItem::new(Service::GitHub, "MyCo"),
26 ])
27 .link("Unsubscribe", "https://example.com")
28 .build()?;
29
30 let verify_email_link = "https://example.com/verify?token=ABC";
31
32 let content = Content::builder()
33 .theme(Theme::Simple)
34 .header(header)
35 .text("Hi there,")
36 .text("Welcome to **MyCo**! We're excited to have you on board. Before we get started, we need to verify your email address.")
37 .text("Please confirm your email by clicking the button below:")
38 .button("Verify Email", verify_email_link)
39 .text("Or use the link below:")
40 .link(verify_email_link, verify_email_link)
41 .footer(footer)
42 .build()?;
43
44 let email = Email::builder()
45 .to(EmailAddress::new(&email_address))
46 .subject("Confirm your email")
47 .content(content)
48 .build()?;
49
50 let templateless = Templateless::new(&api_key);
51 let _ = templateless.send(email).await?;
52
53 Ok(())
54}
examples/qr_code.rs (line 53)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let app_store_link = "https://apps.apple.com/us/app/example/id1234567890";
22 let google_play_link =
23 "https://play.google.com/store/apps/details?id=com.example";
24
25 let footer = Footer::builder()
26 .store_badges(&[
27 StoreBadgeItem::new(StoreBadge::AppStore, app_store_link),
28 StoreBadgeItem::new(StoreBadge::GooglePlay, google_play_link),
29 ])
30 .socials(&[
31 SocialItem::new(Service::Twitter, "MyCo"),
32 SocialItem::new(Service::GitHub, "MyCo"),
33 ])
34 .build()?;
35
36 let content = Content::builder()
37 .theme(Theme::Simple)
38 .header(header)
39 .text("Hey Alex,")
40 .text("Thank you for choosing MyCo! To get started with our mobile experience, simply pair your account with our mobile app.")
41 .text("Here's how to do it:")
42 .text(&[
43 &format!("1. Download the MyCo app from the [App Store]({app_store_link}) or [Google Play]({google_play_link})."),
44 "1. Open the app and select _Pair Device_.",
45 "1. Scan the QR code below with your mobile device:",
46 ].join("\n"))
47 .qr_code("https://example.com/qr-code-link")
48 .text("Enjoy your seamless experience across devices!")
49 .footer(footer)
50 .build()?;
51
52 let email = Email::builder()
53 .to(EmailAddress::new(&email_address))
54 .subject("How to Pair Device")
55 .content(content)
56 .build()?;
57
58 let templateless = Templateless::new(&api_key);
59 let _ = templateless.send(email).await?;
60
61 Ok(())
62}
pub fn to_many(self, email_addresses: Vec<EmailAddress>) -> Self
Sourcepub fn subject(self, subject: &str) -> Self
pub fn subject(self, subject: &str) -> Self
Examples found in repository?
examples/simple.rs (line 12)
4async fn main() -> Result<()> {
5 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
6 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
7
8 Templateless::new(&api_key)
9 .send(
10 Email::builder()
11 .to(EmailAddress::new(&email_address))
12 .subject("Hello 👋")
13 .content(Content::builder().text("Hello world").build()?)
14 .build()?,
15 )
16 .await?;
17
18 Ok(())
19}
More examples
examples/feedback.rs (line 43)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .socials(&[
23 SocialItem::new(Service::Twitter, "MyCo"),
24 SocialItem::new(Service::GitHub, "MyCo"),
25 ])
26 .build()?;
27
28 let content = Content::builder()
29 .theme(Theme::Simple)
30 .header(header)
31 .text("Hey Alex,")
32 .text("I'm Jamie, founder of **MyCo**.")
33 .text("Could you spare a moment to reply to this email with your thoughts on our service? Your feedback is invaluable and directly influences our improvements.")
34 .text("When you hit reply, your email will go directly to me, and I read each and every one.")
35 .text("Thanks for your support,")
36 .signature("Jamie Parker")
37 .text("Jamie Parker\n\nFounder @ [MyCo](https://example.com)")
38 .footer(footer)
39 .build()?;
40
41 let email = Email::builder()
42 .to(EmailAddress::new(&email_address))
43 .subject("Confirm your email")
44 .content(content)
45 .build()?;
46
47 let templateless = Templateless::new(&api_key);
48 let _ = templateless.send(email).await?;
49
50 Ok(())
51}
examples/verification.rs (line 46)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .text("If you did not sign up for a MyCo account, please ignore this email.\nThis link will expire in 24 hours.")
23 .socials(&[
24 SocialItem::new(Service::Twitter, "MyCo"),
25 SocialItem::new(Service::GitHub, "MyCo"),
26 ])
27 .link("Unsubscribe", "https://example.com")
28 .build()?;
29
30 let verify_email_link = "https://example.com/verify?token=ABC";
31
32 let content = Content::builder()
33 .theme(Theme::Simple)
34 .header(header)
35 .text("Hi there,")
36 .text("Welcome to **MyCo**! We're excited to have you on board. Before we get started, we need to verify your email address.")
37 .text("Please confirm your email by clicking the button below:")
38 .button("Verify Email", verify_email_link)
39 .text("Or use the link below:")
40 .link(verify_email_link, verify_email_link)
41 .footer(footer)
42 .build()?;
43
44 let email = Email::builder()
45 .to(EmailAddress::new(&email_address))
46 .subject("Confirm your email")
47 .content(content)
48 .build()?;
49
50 let templateless = Templateless::new(&api_key);
51 let _ = templateless.send(email).await?;
52
53 Ok(())
54}
examples/qr_code.rs (line 54)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let app_store_link = "https://apps.apple.com/us/app/example/id1234567890";
22 let google_play_link =
23 "https://play.google.com/store/apps/details?id=com.example";
24
25 let footer = Footer::builder()
26 .store_badges(&[
27 StoreBadgeItem::new(StoreBadge::AppStore, app_store_link),
28 StoreBadgeItem::new(StoreBadge::GooglePlay, google_play_link),
29 ])
30 .socials(&[
31 SocialItem::new(Service::Twitter, "MyCo"),
32 SocialItem::new(Service::GitHub, "MyCo"),
33 ])
34 .build()?;
35
36 let content = Content::builder()
37 .theme(Theme::Simple)
38 .header(header)
39 .text("Hey Alex,")
40 .text("Thank you for choosing MyCo! To get started with our mobile experience, simply pair your account with our mobile app.")
41 .text("Here's how to do it:")
42 .text(&[
43 &format!("1. Download the MyCo app from the [App Store]({app_store_link}) or [Google Play]({google_play_link})."),
44 "1. Open the app and select _Pair Device_.",
45 "1. Scan the QR code below with your mobile device:",
46 ].join("\n"))
47 .qr_code("https://example.com/qr-code-link")
48 .text("Enjoy your seamless experience across devices!")
49 .footer(footer)
50 .build()?;
51
52 let email = Email::builder()
53 .to(EmailAddress::new(&email_address))
54 .subject("How to Pair Device")
55 .content(content)
56 .build()?;
57
58 let templateless = Templateless::new(&api_key);
59 let _ = templateless.send(email).await?;
60
61 Ok(())
62}
Sourcepub fn content(self, content: Content) -> Self
pub fn content(self, content: Content) -> Self
Examples found in repository?
examples/simple.rs (line 13)
4async fn main() -> Result<()> {
5 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
6 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
7
8 Templateless::new(&api_key)
9 .send(
10 Email::builder()
11 .to(EmailAddress::new(&email_address))
12 .subject("Hello 👋")
13 .content(Content::builder().text("Hello world").build()?)
14 .build()?,
15 )
16 .await?;
17
18 Ok(())
19}
More examples
examples/feedback.rs (line 44)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .socials(&[
23 SocialItem::new(Service::Twitter, "MyCo"),
24 SocialItem::new(Service::GitHub, "MyCo"),
25 ])
26 .build()?;
27
28 let content = Content::builder()
29 .theme(Theme::Simple)
30 .header(header)
31 .text("Hey Alex,")
32 .text("I'm Jamie, founder of **MyCo**.")
33 .text("Could you spare a moment to reply to this email with your thoughts on our service? Your feedback is invaluable and directly influences our improvements.")
34 .text("When you hit reply, your email will go directly to me, and I read each and every one.")
35 .text("Thanks for your support,")
36 .signature("Jamie Parker")
37 .text("Jamie Parker\n\nFounder @ [MyCo](https://example.com)")
38 .footer(footer)
39 .build()?;
40
41 let email = Email::builder()
42 .to(EmailAddress::new(&email_address))
43 .subject("Confirm your email")
44 .content(content)
45 .build()?;
46
47 let templateless = Templateless::new(&api_key);
48 let _ = templateless.send(email).await?;
49
50 Ok(())
51}
examples/verification.rs (line 47)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .text("If you did not sign up for a MyCo account, please ignore this email.\nThis link will expire in 24 hours.")
23 .socials(&[
24 SocialItem::new(Service::Twitter, "MyCo"),
25 SocialItem::new(Service::GitHub, "MyCo"),
26 ])
27 .link("Unsubscribe", "https://example.com")
28 .build()?;
29
30 let verify_email_link = "https://example.com/verify?token=ABC";
31
32 let content = Content::builder()
33 .theme(Theme::Simple)
34 .header(header)
35 .text("Hi there,")
36 .text("Welcome to **MyCo**! We're excited to have you on board. Before we get started, we need to verify your email address.")
37 .text("Please confirm your email by clicking the button below:")
38 .button("Verify Email", verify_email_link)
39 .text("Or use the link below:")
40 .link(verify_email_link, verify_email_link)
41 .footer(footer)
42 .build()?;
43
44 let email = Email::builder()
45 .to(EmailAddress::new(&email_address))
46 .subject("Confirm your email")
47 .content(content)
48 .build()?;
49
50 let templateless = Templateless::new(&api_key);
51 let _ = templateless.send(email).await?;
52
53 Ok(())
54}
examples/qr_code.rs (line 55)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let app_store_link = "https://apps.apple.com/us/app/example/id1234567890";
22 let google_play_link =
23 "https://play.google.com/store/apps/details?id=com.example";
24
25 let footer = Footer::builder()
26 .store_badges(&[
27 StoreBadgeItem::new(StoreBadge::AppStore, app_store_link),
28 StoreBadgeItem::new(StoreBadge::GooglePlay, google_play_link),
29 ])
30 .socials(&[
31 SocialItem::new(Service::Twitter, "MyCo"),
32 SocialItem::new(Service::GitHub, "MyCo"),
33 ])
34 .build()?;
35
36 let content = Content::builder()
37 .theme(Theme::Simple)
38 .header(header)
39 .text("Hey Alex,")
40 .text("Thank you for choosing MyCo! To get started with our mobile experience, simply pair your account with our mobile app.")
41 .text("Here's how to do it:")
42 .text(&[
43 &format!("1. Download the MyCo app from the [App Store]({app_store_link}) or [Google Play]({google_play_link})."),
44 "1. Open the app and select _Pair Device_.",
45 "1. Scan the QR code below with your mobile device:",
46 ].join("\n"))
47 .qr_code("https://example.com/qr-code-link")
48 .text("Enjoy your seamless experience across devices!")
49 .footer(footer)
50 .build()?;
51
52 let email = Email::builder()
53 .to(EmailAddress::new(&email_address))
54 .subject("How to Pair Device")
55 .content(content)
56 .build()?;
57
58 let templateless = Templateless::new(&api_key);
59 let _ = templateless.send(email).await?;
60
61 Ok(())
62}
pub fn delete_after(self, seconds: u64) -> Self
Sourcepub fn build(&self) -> Result<Self>
pub fn build(&self) -> Result<Self>
Examples found in repository?
examples/simple.rs (line 14)
4async fn main() -> Result<()> {
5 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
6 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
7
8 Templateless::new(&api_key)
9 .send(
10 Email::builder()
11 .to(EmailAddress::new(&email_address))
12 .subject("Hello 👋")
13 .content(Content::builder().text("Hello world").build()?)
14 .build()?,
15 )
16 .await?;
17
18 Ok(())
19}
More examples
examples/feedback.rs (line 45)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .socials(&[
23 SocialItem::new(Service::Twitter, "MyCo"),
24 SocialItem::new(Service::GitHub, "MyCo"),
25 ])
26 .build()?;
27
28 let content = Content::builder()
29 .theme(Theme::Simple)
30 .header(header)
31 .text("Hey Alex,")
32 .text("I'm Jamie, founder of **MyCo**.")
33 .text("Could you spare a moment to reply to this email with your thoughts on our service? Your feedback is invaluable and directly influences our improvements.")
34 .text("When you hit reply, your email will go directly to me, and I read each and every one.")
35 .text("Thanks for your support,")
36 .signature("Jamie Parker")
37 .text("Jamie Parker\n\nFounder @ [MyCo](https://example.com)")
38 .footer(footer)
39 .build()?;
40
41 let email = Email::builder()
42 .to(EmailAddress::new(&email_address))
43 .subject("Confirm your email")
44 .content(content)
45 .build()?;
46
47 let templateless = Templateless::new(&api_key);
48 let _ = templateless.send(email).await?;
49
50 Ok(())
51}
examples/verification.rs (line 48)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let footer = Footer::builder()
22 .text("If you did not sign up for a MyCo account, please ignore this email.\nThis link will expire in 24 hours.")
23 .socials(&[
24 SocialItem::new(Service::Twitter, "MyCo"),
25 SocialItem::new(Service::GitHub, "MyCo"),
26 ])
27 .link("Unsubscribe", "https://example.com")
28 .build()?;
29
30 let verify_email_link = "https://example.com/verify?token=ABC";
31
32 let content = Content::builder()
33 .theme(Theme::Simple)
34 .header(header)
35 .text("Hi there,")
36 .text("Welcome to **MyCo**! We're excited to have you on board. Before we get started, we need to verify your email address.")
37 .text("Please confirm your email by clicking the button below:")
38 .button("Verify Email", verify_email_link)
39 .text("Or use the link below:")
40 .link(verify_email_link, verify_email_link)
41 .footer(footer)
42 .build()?;
43
44 let email = Email::builder()
45 .to(EmailAddress::new(&email_address))
46 .subject("Confirm your email")
47 .content(content)
48 .build()?;
49
50 let templateless = Templateless::new(&api_key);
51 let _ = templateless.send(email).await?;
52
53 Ok(())
54}
examples/qr_code.rs (line 56)
8async fn main() -> Result<()> {
9 let api_key = utils::get_env("TEMPLATELESS_API_KEY");
10 let email_address = utils::get_env("TEMPLATELESS_EMAIL_ADDRESS");
11
12 let header = Header::builder()
13 .component(
14 Image::new("https://templateless.net/myco.webp")
15 .width(100)
16 .alt("MyCo")
17 .build()?,
18 )
19 .build()?;
20
21 let app_store_link = "https://apps.apple.com/us/app/example/id1234567890";
22 let google_play_link =
23 "https://play.google.com/store/apps/details?id=com.example";
24
25 let footer = Footer::builder()
26 .store_badges(&[
27 StoreBadgeItem::new(StoreBadge::AppStore, app_store_link),
28 StoreBadgeItem::new(StoreBadge::GooglePlay, google_play_link),
29 ])
30 .socials(&[
31 SocialItem::new(Service::Twitter, "MyCo"),
32 SocialItem::new(Service::GitHub, "MyCo"),
33 ])
34 .build()?;
35
36 let content = Content::builder()
37 .theme(Theme::Simple)
38 .header(header)
39 .text("Hey Alex,")
40 .text("Thank you for choosing MyCo! To get started with our mobile experience, simply pair your account with our mobile app.")
41 .text("Here's how to do it:")
42 .text(&[
43 &format!("1. Download the MyCo app from the [App Store]({app_store_link}) or [Google Play]({google_play_link})."),
44 "1. Open the app and select _Pair Device_.",
45 "1. Scan the QR code below with your mobile device:",
46 ].join("\n"))
47 .qr_code("https://example.com/qr-code-link")
48 .text("Enjoy your seamless experience across devices!")
49 .footer(footer)
50 .build()?;
51
52 let email = Email::builder()
53 .to(EmailAddress::new(&email_address))
54 .subject("How to Pair Device")
55 .content(content)
56 .build()?;
57
58 let templateless = Templateless::new(&api_key);
59 let _ = templateless.send(email).await?;
60
61 Ok(())
62}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Email
impl !RefUnwindSafe for Email
impl Send for Email
impl !Sync for Email
impl Unpin for Email
impl !UnwindSafe for Email
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more