RESPONSE:
Unfortunately, it is not feasible to use "send the email from the server or cPanel using only angular". Angular is specifically designed for front-end operations.
A POSSIBLE SOLUTION:
To address this issue, consider implementing a server-side application (such as node js) on the shared server. This will enable you to execute server-side code and facilitate sending emails.
SUBMITTING DATA FROM ANGULAR APPLICATION TO NODE JS:
Ensure you include HttpClientModule in your angular app.module.ts file. Additionally, import HttpClient into the relevant typescript file to allow for data submission using the "POST" method to the newly integrated node js application.
this.http.post('/send', f.value)
.subscribe((res) => {
console.log(res);
});
EMAIL DELIVERY PROCESS:
Once the node js application receives the data, utilize nodemailer along with conventional code to compose and dispatch an email through SMTP protocol.
OUTCOMES:
Feel free to access the code for both the angular and node js applications soon on GitHub. You can view the finalized product at JamesEllisDev.com.