Description
EmailFactories.from_env honors EMAIL_SERVER, EMAIL_USERNAME, and EMAIL_PASSWORD, but there is no equivalent for port or ssl. When EMAIL_SERVER is set, a Credentials is built with the hard-coded defaults port=993, ssl=True, so a user who needs to point at an IMAP server on a non-standard port (Proton Bridge on 127.0.0.1:1143, dev sandboxes, IMAP-over-STARTTLS on 143) cannot do so via env vars.
Location
email_profile/core/credentials.py lines ~43-71
Current Behavior
server = os.environ.get(server_var)
if server:
return Credentials(server=server, user=user, password=password)
# else fall back to from_address auto-discovery (also no port/ssl override)
port / ssl are silently fixed to the dataclass defaults.
Expected Behavior
Read EMAIL_PORT and EMAIL_SSL (or configurable env-var names) and forward them into Credentials. Validate types.
Suggested Fix
@classmethod
def from_env(
cls,
server_var="EMAIL_SERVER",
user_var="EMAIL_USERNAME",
password_var="EMAIL_PASSWORD",
port_var="EMAIL_PORT",
ssl_var="EMAIL_SSL",
load_dotenv=True,
) -> Credentials:
...
port = int(os.environ.get(port_var, 993))
ssl_raw = os.environ.get(ssl_var, "true").strip().lower()
ssl = ssl_raw in ("1", "true", "yes", "on")
server = os.environ.get(server_var)
if server:
return Credentials(
server=server, user=user, password=password, port=port, ssl=ssl,
)
return cls.from_address(user, password, port=port, ssl=ssl)
Document the new variables in the README's .env example.
Impact
Anyone deploying via .env-driven configuration cannot connect to non-standard ports without dropping out of the high-level Email.from_env() flow.
Priority
High
Description
EmailFactories.from_envhonorsEMAIL_SERVER,EMAIL_USERNAME, andEMAIL_PASSWORD, but there is no equivalent forportorssl. WhenEMAIL_SERVERis set, aCredentialsis built with the hard-coded defaultsport=993, ssl=True, so a user who needs to point at an IMAP server on a non-standard port (Proton Bridge on127.0.0.1:1143, dev sandboxes, IMAP-over-STARTTLS on 143) cannot do so via env vars.Location
email_profile/core/credentials.pylines ~43-71Current Behavior
port/sslare silently fixed to the dataclass defaults.Expected Behavior
Read
EMAIL_PORTandEMAIL_SSL(or configurable env-var names) and forward them intoCredentials. Validate types.Suggested Fix
Document the new variables in the README's
.envexample.Impact
Anyone deploying via
.env-driven configuration cannot connect to non-standard ports without dropping out of the high-levelEmail.from_env()flow.Priority
High