Search code examples
emailgmailmailhog

Send mail from Mailhog to Gmail but gmail can't receive mail


I'm try to use api in mailhog
Get /api/v1/messages

[
    {
        "ID": "[email protected]",
        "From": {
            "Relays": null,
            "Mailbox": "developer-send-mail",
            "Domain": "gmail.com",
            "Params": ""
        },
        "To": [
            {
                "Relays": null,
                "Mailbox": "developer-recv-mail",
                "Domain": "gmail.com",
                "Params": ""
            }
        ],
        "Content": {
            "Headers": {
                "Message-ID": [
                    "[email protected]"
                ],
                "Received": [
                    "from smtp.gmail.com by mailhog.example (MailHog)\r\n          id [email protected]; Mon, 22 Nov 2021 18:30:16 +0000"
                ],
                "Return-Path": [
                    "<[email protected]>"
                ]
            },
            "Body": "test my message\r\nnew1\r\nmulti line",
            "Size": 33,
            "MIME": null
        },
        "Created": "2021-11-22T18:30:16.822037969Z",
        "MIME": null,
        "Raw": {
            "From": "[email protected]",
            "To": [
                "[email protected]"
            ],
            "Data": "test my nessaje\r\nnew1\r\nmulti line",
            "Helo": "smtp.gmail.com"
        }
    },
]

and I
Post /api/v1/messages/[email protected]/release
Body

{
    "Host": "smtp.gmail.com",
    "Port": "587",
    "Username": "[email protected]",
    "Password": "MyMailPassword",
    "Mechanism": "PLAIN",
    "Email": "[email protected]"
}

Response code: 200
but in gmail [email protected] can't receive this email


Solution

  • In your post value for release endpoint, you specify an Email value of [email protected]. Since this value is the recipient, I believe this should be [email protected] from the sound of it?

    https://github.com/mailhog/MailHog/blob/master/docs/APIv1.md#post-apiv1messages-message_id-release