Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Ionic 4 Sendgrid for Contact Us Page

$
0
0

@AIBug wrote:

I’m trying to use Sendgrid (mailing service) for my contact page in my app. But… I’m not sure how… I think I’m close. Can anyone help me?

This is the code when the user hits the submission button…

async submit(form: NgForm) {
    this.submitted = true;

    if (form.valid) {
      this.supportMessage = '';
      this.submitted = false;

      const toast = await this.toastCtrl.create({
        message: 'Your support request has been sent.',
        duration: 3000
      
        const sgMail = require('@sendgrid/mail');
        sgMail.setApiKey(process.env.SENDGRID_API_KEY);
        msg = {
          to: 'test@example.com',
          from: 'test@example.com',
          subject: 'Sending with Twilio SendGrid is Fun',
          text: 'and easy to do anywhere, even with Node.js',
          html: '<strong>and easy to do anywhere, even with Node.js</strong>',
        };
        this.sgMail.send(msg);

      
      });
      await toast.present();
    }
  }

MailErrors

I also added a picture so you could see the error.

Sorry if I’m wasting your time over something that’s simple.

Hope you can help :slight_smile:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>