SendGrid不是在谷歌应用程序引擎的端点工作 [英] SendGrid not working in Google app engine endpoints

查看:250
本文介绍了SendGrid不是在谷歌应用程序引擎的端点工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要发送信息,以谷歌的端点,然后设置对象,Sendgrid,然后发送电子邮件。这些电子邮件不工作,没有什么是通过从应用程序引擎发送。

I need to send info to the google endpoint, which then sets up object with Sendgrid and then sends the email. The emails are not working, nothing is sent through from the app engine.

我的终点code的部分:

Part of my endpoint code:

@ApiMethod(name = "sendEmail")
public sendEmailObject sendEmail(@Named("sendTo") String sendTo, @Named("sentFromClient") String sentFromClient, @Named("sendDescription") String sendDescription) {

    SendGrid sendgrid = new SendGrid(..., ...);
    SendGrid.Email email = new SendGrid.Email();
    email.addTo(..);
    email.addToName(..);
    email.setReplyTo(..);
    email.setSubject(..);
    email.setText(..);
    email.setFrom(...);

    sendEmailObject emailoObject = new sendEmailObject();
    try {
        SendGrid.Response response = sendgrid.send(email);
        emailoObject.setSendMailSucccess(response.getMessage().toString());
    } catch (SendGridException e) {
        e.printStackTrace();
        emailoObject.setSendMailSucccess(e.toString());
    }

有什么我需要在应用程序引擎设置?就像打开一个端口或者一些其他的设置? Sendgrid似乎使用端口5252,但不知道在哪里,让该端口,或者如果它的自动完成?
报考Sendgrid时,比应用程序引擎我也用不同的电子邮件,这可能会引起问题?

Is there something I need to set on the app engine? Like opening a port or some other settings? Sendgrid seems to use port 5252, but have no idea where to allow that port, or if its automatically done? I also used a different email when registering for Sendgrid, than App engine, could this cause a problem?

推荐答案

但问题是,创建一个Sendgrid对象时,我用的用户名和密码。当我改变了对sendgrid产生的关键,它的工作!

The problem was that when creating an Sendgrid object I used username and password. When I changed that to the key generated on sendgrid it worked!!!

 SendGrid sendgrid = new SendGrid("key");

这篇关于SendGrid不是在谷歌应用程序引擎的端点工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆