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": "ZOif6IQhqZgViFi2HO4e8KBSJBAzlwwJ-92rCBccNU8=@mailhog.example",
        "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": [
                    "ZOif6IQhqZgViFi2HO4e8KBSJBAzlwwJ-92rCBccNU8=@mailhog.example"
                ],
                "Received": [
                    "from smtp.gmail.com by mailhog.example (MailHog)\r\n          id ZOif6IQhqZgViFi2HO4e8KBSJBAzlwwJ-92rCBccNU8=@mailhog.example; Mon, 22 Nov 2021 18:30:16 +0000"
                ],
                "Return-Path": [
                    "<developer-send-mail@gmail.com>"
                ]
            },
            "Body": "test my message\r\nnew1\r\nmulti line",
            "Size": 33,
            "MIME": null
        },
        "Created": "2021-11-22T18:30:16.822037969Z",
        "MIME": null,
        "Raw": {
            "From": "developer-send-mail@gmail.com",
            "To": [
                "developer-recv-mail@gmail.com"
            ],
            "Data": "test my nessaje\r\nnew1\r\nmulti line",
            "Helo": "smtp.gmail.com"
        }
    },
]

and I
Post /api/v1/messages/ZOif6IQhqZgViFi2HO4e8KBSJBAzlwwJ-92rCBccNU8=@mailhog.example/release
Body

{
    "Host": "smtp.gmail.com",
    "Port": "587",
    "Username": "developer-send-mail@gmail.com",
    "Password": "MyMailPassword",
    "Mechanism": "PLAIN",
    "Email": "developer-send-mail@gmail.com"
}

Response code: 200
but in gmail developer-recv-mail@gmail.com can't receive this email


Solution

  • In your post value for release endpoint, you specify an Email value of developer-send-mail@gmail.com. Since this value is the recipient, I believe this should be developer-recv-mail@gmail.com from the sound of it?

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