Sending email through Appcelerator Cloud API

2019-07-20 01:40发布

I was trying to send email through Appcelerator Cloud Service, in my Titanium app. The code I'm using is the standart one, given at the documentation site. But the email is not being sent.

Cloud.Emails.send({
    template: 'welcome',
    recipients: '*******@gmail.com'
    },
    function (e) {
        if (e.success) {
        Titanium.API.info('Email sent successfully.');
    } else {
        Titanium.API.info('Error:\\n' +
            ((e.error && e.message) || JSON.stringify(e)));
    }
});

It give the this error, 'Email template welcome is not found'. I was thinking that template is the message to be sent in email. There is no help on API about this attribute , template. Can anybody explain it to me? I'll be thankful.

Thanx

2条回答
Bombasti
2楼-- · 2019-07-20 02:08

That error means you haven't created an email template on the ACS website yet. Log in to your Appcelerator App Console, click "Manage ACS" under the app you're working on, then click the "Email Templates" tab, and "Create an Email Template".

查看更多
【Aperson】
3楼-- · 2019-07-20 02:15

The error shows that you haven't created an email template on the ACS website yet. The following steps will help you to create email template

  1. Log in to your Appcelerator App Console
  2. click "Manage ACS" under the app you're working on
  3. click the "Email Templates" tab
  4. "Create an Email Template".

also you can setup your SMTP settings as follows which worked for me.

Username: ________@gmail.com Password: gmail account password TLS: true/ false (both will work) SMTP Address: smtp.gmail.com Port: 587 Domain : www.gmail.com

查看更多
登录 后发表回答