I am encountering an error that states the 'from' parameter is missing in the body. Can you help me troubleshoot why this issue is happening?
export class EmailService {
constructor(private http: HttpClient) {}
sendMailgunMessage() {
const options = {
headers: new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded'
})
};
const body = {
username: 'api',
password: 'key-xxx',
from: '<<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="254d4049494a654455550b5d5d5d0b46a48">[email protected]</a>>',
to: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ea929292aa92c4898587">[email protected]</a>',
subject: 'Subject text',
text: 'Body text',
multipart: true
};
return this.http.post('https://api.mailgun.net/v3/app.xxx.com/messages', body, options);
}
}
Upon subscribing to the sendMailgunMessage function, I receive a browser error: HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "BAD REQUEST"...error : {message: "'from' parameter is missing"}
To ensure privacy, I have replaced sensitive information with xxx. I have also attempted to include the API key in the URL, but still encountered the same 'from' parameter error.