Struct Email

Source
pub struct Email { /* private fields */ }

Implementations§

Source§

impl Email

Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

pub fn to_many(self, email_addresses: Vec<EmailAddress>) -> Self

Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

pub fn delete_after(self, seconds: u64) -> Self

Source

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
Hide additional 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§

Source§

impl Clone for Email

Source§

fn clone(&self) -> Email

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Serialize for Email

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,