Skip to content

Auth Error with AWS SES #141

@leviouwendijk

Description

@leviouwendijk

Hi, I've been trying an implementation using AWS SMTP credentials (which rejects .plain authentication). But it seems not to work, regardless of what I try:

Bad response received for command. command: (), response: 535 AUTH failed

Main implementations I tried:

        let smtp = SMTP(
            hostname: host,
            email: user,
            password: password,
            port: 587,
            tlsMode: .requireSTARTTLS,
            authMethods: [.login]
        )
        let smtp = SMTP(
            hostname: host,
            email: user,
            password: password,
            port: 465,
            tlsMode: .requireTLS,
            authMethods: [.login]
        )

Both fail the same with [.cramMD5].

When I use swaks, everything works fine:

swaks --to "$TO" \
    --cc "$CC" \
    --from "$FROM" \
    --header "$FROM_HEADER" \
    --header "$REPLY_TO" \
    --server "$SMTP_SERVER" \
    --port "$SMTP_PORT" \
    --auth LOGIN \
    --auth-user "$SMTP_USER" \
    --auth-password "$SMTP_PASS" \
    --tls \
    --header "Subject: $SUBJECT" \
    --header "Content-Type: text/html" \
    --body $BODY \
    --attach $ATTACHMENT --attach-type "application/pdf"

Not sure what Swift-SMTP and swaks are doing differently under the hood.

Any ideas why this auth is failing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions