Jobs
Jobs

Reputation: 259

How to send emails using google smtp with angular 4

I want to send mails using google smpt with my angular 4 app. I tried to send emails using email js. but I couldn't use it with my angular 4 app. when I try to import, it says no any modules. how can I send mails using this existing library or , is there any other way to send mails with angular 4 application using google smpt.

Upvotes: 1

Views: 21280

Answers (2)

Adam Pery
Adam Pery

Reputation: 2102

Use npm emailjs package

Installing the package:

npm install emailjs

Upvotes: 1

DrNio
DrNio

Reputation: 1976

What you are trying to do won't work. You need a nodejs server-side app for that framework. From emailjs page you sent: send emails, html and attachments (files, streams and strings) from node.js to any smtp server.

Try this service instead https://www.emailjs.com/docs/api-reference/installation/

<script type="text/javascript" src="https://cdn.emailjs.com/dist/email.min.js"></script>
<script type="text/javascript">
   (function(){
      emailjs.init("YOUR USER ID");
   })();
</script>

You need to create an account in their website and replace the "YOUR USER ID" with your personal ID of your account.

Upvotes: 5

Related Questions