1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! Proton Bridge provider for sending emails through a local Proton Mail Bridge.
//!
//! This is a thin wrapper around the SMTP adapter, pre-configured to connect to
//! a locally running [Proton Bridge](https://proton.me/mail/bridge) instance.
//!
//! # How It Works
//!
//! Proton Bridge is a desktop application that runs a local SMTP/IMAP server,
//! acting as a bridge between standard email clients and Proton Mail's encrypted
//! infrastructure:
//!
//! ```text
//! Your App → localhost:1025 → Proton Bridge → Proton Mail servers
//! ```
//!
//! The Bridge handles:
//! - Authentication with Proton's servers
//! - PGP encryption (Proton's end-to-end encryption)
//! - Queuing and delivery to Proton Mail
//!
//! # Prerequisites
//!
//! 1. Install [Proton Bridge](https://proton.me/mail/bridge)
//! 2. Log in to your Proton Mail account in the Bridge app
//! 3. Get the SMTP credentials from Bridge (username/password)
//! 4. Keep Bridge running while sending emails
//!
//! # Example
//!
//! ```rust,ignore
//! use missive::providers::ProtonBridgeMailer;
//!
//! // Using Bridge credentials from the desktop app
//! let mailer = ProtonBridgeMailer::new("your-bridge-username", "your-bridge-password");
//!
//! // Custom port (default is 1025)
//! let mailer = ProtonBridgeMailer::new("username", "password")
//! .port(1026);
//! ```
//!
//! # Environment Variables
//!
//! ```bash
//! EMAIL_PROVIDER=protonbridge
//! PROTONBRIDGE_USERNAME=your-bridge-username
//! PROTONBRIDGE_PASSWORD=your-bridge-password
//! PROTONBRIDGE_PORT=1025 # optional, defaults to 1025
//! PROTONBRIDGE_HOST=127.0.0.1 # optional, defaults to 127.0.0.1
//! ```
//!
//! # Security Notes
//!
//! - No TLS is used for the localhost connection (the Bridge handles encryption)
//! - The Bridge credentials are separate from your Proton Mail password
//! - Keep the Bridge running for emails to be delivered
use async_trait;
use crateEmail;
use crateMailError;
use crate;
use crateSmtpMailer;
/// Proton Bridge email provider.
///
/// A thin wrapper around [`SmtpMailer`] pre-configured for Proton Bridge's
/// local SMTP server (default: `127.0.0.1:1025`, no TLS).
///
/// See [Proton Bridge](https://proton.me/mail/bridge) for setup instructions.
/// Builder for ProtonBridgeMailer.