Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending email : "403 Forbidden" Only for MIME message #1499

Open
francescodiperna opened this issue Apr 4, 2024 · 0 comments
Open

Sending email : "403 Forbidden" Only for MIME message #1499

francescodiperna opened this issue Apr 4, 2024 · 0 comments

Comments

@francescodiperna
Copy link

Hi, I'm using the version 1.110.
I have the following error trying to send an email in MIME type:

Client error: `POST https://graph.microsoft.com/v1.0/users/[EMAIL_ADDRESS]/sendMail` resulted in a `403 Forbidden` response:
{"error":{"code":"ErrorSendAsDenied","message":"The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message."}}

The code used to send is the following:

$requestUrl = '/users/' . $username . '/sendMail';        
        $emailResponse = $this->graphClient->createRequest('POST', $requestUrl)
            ->addHeaders(["Content-Type" => "text/plain"])
            ->attachBody(base64_encode(serialize([
                "Content-Type" => "text/plain",
                'message' => $mimeContent
            ])))->execute();

With the same email account, if I send an email in Json format I do not have any error.

Any Idea how to solve?
Thanks

Francesco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant