shoaib hayat
shoaib hayat

Reputation: 21

How to send email using aws with different regions?

We need to send invitation email from our website hosted on an EC2 instance. Our regular email service is hosted by Google.

The problem is that we are based in US East Ohio region where SES is not available. So can we change our region just for using SES? Will it impact our EC2 instance? Can't find any documentation regarding this.

and when i try to send email the error come is

{ 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)

message: 'Inaccessible host: email.us-east-2.amazonaws.com\'. This service may not be available in theus-east-2\' region.', code: 'UnknownEndpoint', region: 'us-east-2', hostname: 'email.us-east-2.amazonaws.com', retryable: true, originalError: { Error: getaddrinfo ENOTFOUND email.us-east-2.amazonaws.com email.us-east-2.amazonaws.com:443 at errnoException (dns.js:55:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:26) message: 'getaddrinfo ENOTFOUND email.us-east-2.amazonaws.com email.us-east-2.amazonaws.com:443', code: 'NetworkingError', errno: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'email.us-east-2.amazonaws.com', host: 'email.us-east-2.amazonaws.com', port: 443, region: 'us-east-2', retryable: true, time: 2018-02-26T10:08:25.003Z }, time: 2018-02-26T10:08:25.003Z } 'UnknownEndpoint: Inaccessible host: email.us-east-2.amazonaws.com\'. This service may not be available in theus-east-2\' region.\n at Request.ENOTFOUND_ERROR (/home/pc-09/PlayScoreApi\'s/node_modules/aws-sdk/lib/event_listeners.js:456:46)\n at Request.callListeners (/home/pc-09/PlayScoreApi\'s/node_modules/aws-sdk/lib/sequential_executor.js:105:20)\n at Request.emit (/home/pc-09/PlayScoreApi\'s/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\n at Request.emit (/home/pc-09/PlayScoreApi\'s/node_modules/aws-sdk/lib/request.js:683:14)\n at ClientRequest.error (/home/pc-09/PlayScoreApi\'s/node_modules/aws-sdk/lib/event_listeners.js:295:22)\n at ClientRequest. (/home/pc-09/PlayScoreApi\'s/node_modules/aws-sdk/lib/http/node.js:89:19)\n at ClientRequest.emit (events.js:160:13)\n at TLSSocket.socketErrorListener (_http_client.js:389:9)\n at TLSSocket.emit (events.js:160:13)\n at emitErrorNT (internal/streams/destroy.js:64:8)\n at process._tickCallback (internal/process/next_tick.js:152:19)'

Upvotes: 2

Views: 1814

Answers (3)

shoaib hayat
shoaib hayat

Reputation: 21

Thank You all for answering, I have solved this issue by sending mail using Simple SMTP like nodemailer in nodejs Without AWS Config. So, when i load code on AWS server, then it sending mails.

Upvotes: 0

krishna_mee2004
krishna_mee2004

Reputation: 7366

You can invoke SES endpoint in other regions without issues. However, SES is supported in a few regions only. They are: Virginia, Oregon and Ireland. The details can be found here. Ohio is currently not yet supported.

Upvotes: 0

E.J. Brennan
E.J. Brennan

Reputation: 46879

It's no problem using SES endpoint from another region, it will work just fine - there may be some additional costs related to out-of-region bandwidth charges as you ec2 instance will be sending traffic to another region, but unless you are sending a tremendous amount of email, I can't image it will amount to much at all.

Upvotes: 1

Related Questions