mailjet / mailjet-apiv3-php

[API v3] Mailjet PHP Wrapper
http://dev.mailjet.com
MIT License
263 stars 86 forks source link

Sending an email with a wrong sender return success without errors in v3 & v3.1 #219

Closed zorx closed 3 years ago

zorx commented 3 years ago

Hi,

According to the documentation, if we specify a wrong mail sender, the api should return an error, but in reality it's not the case.

$key = 'KEY';
$secret = 'SECRET';
$from = 'wrong-sender@example.com';
$to = "test@example.com"

$mj = new \Mailjet\Client($key, $secret, true, ['version' => 'v3.1']);
$body = [
    'Messages' => [
        [
            'From' => [
                'Email' => $from,
                'Name' => "Test"
            ],
            'To' => [
                [
                    'Email' => $to,
                ]
            ],
            'Subject' => "Subject Test",
            'TextPart' => "Subject Test",
        ]
    ]
];

$response = $mj->post(\Mailjet\Resources::$Email, ['body' => $body]);
print_r($response); // everything is success without any errors

so how can I retrieve this information ?

uavn commented 3 years ago

@zorx if you are using well-formatted email address with some name, at sign, domain with domain zone (something@somewhere.com) - it means that this email can be valid, and in this case you'll receive an email to approve that sender's address: Screenshot from 2021-03-01 19-21-36

but when you will use non-well formatted email, such as 'wrong-senderexample.com' (at sign (@) missing) - you'll get an error: Screenshot from 2021-03-01 19-21-55