如何使用具有不同地区的AWS发送电子邮件



我们需要从EC2实例上托管的网站发送邀请电子邮件。我们的常规电子邮件服务由Google主持。

问题在于我们位于美国东俄亥俄地区,那里没有SES。那么,我们可以更改我们的区域以使用SES吗?它会影响我们的EC2实例吗?找不到有关此文件的任何文件。

我尝试发送电子邮件时,错误是

{ UnknownEndpoint: Inaccessible host: `email.us-east-2.amazonaws.com'. This service may not be available in the `us-east-2' region.
at Request.ENOTFOUND_ERROR (/home/pc-09/PlayScoreApi's/node_modules/aws-sdk/lib/event_listeners.js:456:46)
at Request.callListeners (/home/pc-09/PlayScoreApi's/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/home/pc-09/PlayScoreApi's/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/home/pc-09/PlayScoreApi's/node_modules/aws-sdk/lib/request.js:683:14)
at ClientRequest.error (/home/pc-09/PlayScoreApi's/node_modules/aws-sdk/lib/event_listeners.js:295:22)
at ClientRequest.<anonymous> (/home/pc-09/PlayScoreApi's/node_modules/aws-sdk/lib/http/node.js:89:19)
at ClientRequest.emit (events.js:160:13)
at TLSSocket.socketErrorListener (_http_client.js:389:9)
at TLSSocket.emit (events.js:160:13)
at emitErrorNT (internal/streams/destroy.js:64:8)
at process._tickCallback (internal/process/next_tick.js:152:19)

消息:'无法访问的主机: email.us-east-2.amazonaws.com'. This service may not be available in the us-east-2 '区域。', 代码:"未知点", 区域:" us-east-2', 主机名:" email.us-east-2.amazonaws.com", 重试:是的, Originalerror: {错误:getAddrinfo enotfound email.us-east-2.amazonaws.com email.us-east-2.amazonaws.com:443 在ErrnoException(DNS.JS:55:10( 在getAddrinForeQwrap.onlookup [as onComplete](DNS.JS:97:26( 消息:'getAddrinfo enotfound email.us-east-2.amazonaws.com email.us-east-2.amazonaws.com:443', 代码:" NetworkingError", errno:" enotfound", syscall:" getaddrinfo', 主机名:" email.us-east-2.amazonaws.com", 主持人:'email.us-east-2.amazonaws.com', 港口:443, 区域:" us-east-2', 重试:是的, 时间:2018-02-26T10:08:25.003Z}, 时间:2018-02-26T10:08:25.003Z}'unknownendpoint:不可访问的主机: email.us-east-2.amazonaws.com'. This service may not be available in the us-east-2 'region。AWS-SDK/lib/event_listeners.js:456:46( n请求。n请访问emit(/home/pc-09/playscoreapi 's/node_modules/aws-sdk/lib/sequential_executor.js:77:10) n request.emit(/home/pc-09/playayscoreapi \\\'s/node_modules/aws-sdk/lib/request.js:683:14( n在clientRequest.error(/home/pc-09/playscoreapi 's/node_modules/aws-sdk/aws-sdk/lib/lib/lib/event_listeners.js:295:22( n在ClientRequest。(/home/pc-09/playscoreapi 's/node_modules/aws-sdk/lib/http/http/node.js:89:19:19) n clientrequest.emit(events.js:160:160:13(.socketErrorListener(_http_client.js:389:9( n在tlssocket.emit(events.js:160:13(内部/process/next_tick.js:152:19('

使用来自另一个区域的SES端点,这是没有问题的,它可以正常工作 - 由于您的EC2实例将发送流量,可能会有一些与区域外带宽费用有关到另一个区域,但是除非您发送了大量电子邮件,否则我完全不像它完全相当。

您可以在没有问题的其他区域中调用SES端点。但是,仅在几个地区支持SES。他们是:弗吉尼亚州,俄勒冈和爱尔兰。详细信息可以在这里找到。俄亥俄州目前尚未支持。

谢谢大家的回答,我已经通过使用nodejs中的nodemailer之类的简单smtp发送邮件来解决此问题,而无需AWS配置。因此,当我在AWS服务器上加载代码时,然后发送邮件。

相关内容

  • 没有找到相关文章

最新更新