# איך לשלוח אימיילים בשרת עם חסומים של 25/465/587 חיצוניים

**URL:** https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309
**Category:** Support
**Created:** [27 באפריל,‏ 2018,‏ 2:56pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309 "2018-04-27T14:56:57Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [27 באפריל,‏ 2018,‏ 2:56pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/1 "2018-04-27T14:56:57Z")

</div>

Recently I switch my host provider to Google Cloud Platform. Everything works great until I found outgoing mail traffic is blocked by Google.

> Google Compute Engine does not allow outbound connections on ports 25, 465, and 587  
> See [Sending email from an instance &nbsp;|&nbsp; Compute Engine &nbsp;|&nbsp; Google Cloud Documentation](https://cloud.google.com/compute/docs/tutorials/sending-mail/) for detail.

Google advises using SendGrid, Mailgun, or Mailjet. However, since I didn’t see any Mailgun plugin for Discourse (two repo on GitHub indeed, but one hasn’t been updated since 2015, and the other even breaks the rebuild of Discourse), I formerly use SMTP to send emails via Mailgun, but this way has been blocked by Google. So my site’s email system is totally breaking down.

Is there any solution?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 באפריל,‏ 2018,‏ 3:24pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/2 "2018-04-27T15:24:43Z")

</div>

You don’t need a plugin to use mailgun with discourse. However, it is also very clear that if all 3 ports are blocked then you won’t be able to use mailgun.

You can try going with elasticemail they support port 2525 which is very rare to be blocked.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [27 באפריל,‏ 2018,‏ 4:04pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/3 "2018-04-27T16:04:19Z")

</div>

hmmmmm…I think using their API is the “native” way to use Mailgun and SMTP is just for compatibility. I don’t know if I’m right. But I think it may be feasible to use another server as a relay via an SSH tunnel. I have no idea how to actually do this. But I noticed there are some people doing this way, though they are not for Discourse. Theoretically, it should work.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [27 באפריל,‏ 2018,‏ 4:13pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/4 "2018-04-27T16:13:42Z")

</div>

_Theoretically_ is very different than **IRL**

Discourse does not support sending through API and this has been discussed earlier multiple times. This won’t be implemented unless there is a single, open source standard to send emails via API.

Individual developers may make plug in for discourse but it won’t really help in any way as email is required at the time of first run in order for admin to recieve the activation email.

Though it may be possible to install a plugin at that phase, it is neither recommended nor is documented anywhere by discourse in their [official install](https://meta.discourse.org/t/142537?silent=true) guides.

I highly doubt someone is going to work on  
A. Creating a plugin  
B. Writing a guide to compile discourse with their plugin  
C. Maintain a plugin for discourse for as long as discourse exists and the API standard doesn’t.

That too Just to add a functionality that is product specific and isn’t reliable.

One solution can be to run something like a local smtp2api script that takes all details from the SMTP and then sends it via API. That still would require a lot of effort and time.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [27 באפריל,‏ 2018,‏ 5:51pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/5 "2018-04-27T17:51:36Z")

</div>

If you use port 2525 as @itsbhanusharma recommended it will work with all mail delivery services that I have tested. I have done dozens of installs this way.

Another solution would be to develop a plugin that delivers mail through the API. Thus far, no one has seen the need to do that. If you have a budget of $1000 or more, you could post in #Marketplace and see if anyone is interested in developing one.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [27 באפריל,‏ 2018,‏ 7:20pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/6 "2018-04-27T19:20:55Z")

</div>

> [@pfaffman](#):
>
> Another solution would be to develop a plugin that delivers mail through the API.

Yet more possibilities:

- IPsec (or some other opaque tunnel) to a mailserver you control
- maybe there is an HTTPS SMTP transport agent for e.g. postfix, so you can have postfix listen for local mail but submit outside over HTTPS

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [28 באפריל,‏ 2018,‏ 2:07am UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/7 "2018-04-28T02:07:51Z")

</div>

> [@pfaffman](#):
>
> If you use port 2525 as @itsbhanusharma recommended it will work with all mail delivery services that I have tested. I have done dozens of installs this way.

Wow, you saved my day! Though it is not officially documented by Mailgun, this approach does work.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [28 באפריל,‏ 2018,‏ 5:35am UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/8 "2018-04-28T05:35:22Z")

</div>

> [@Vencent](#):
>
> Though it is not officially documented by Mailgun

I bet it is indeed documented here:

> **[Where can I find my API keys and SMTP credentials?](https://help.mailgun.com/hc/en-us/articles/203380100-Where-can-I-find-my-API-keys-and-SMTP-credentials)**
>
> Overview
> Authentication is required any time you wish to relay messages through our platform. When using our API, you need to use one of your account's API keys (either an Account API Key or a Doma...

This Page clearly states:

> Google Compute Engine allows port 2525 for SMTP submission.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [8 ביוני,‏ 2024,‏ 12:37pm UTC](https://meta.discourse.org/t/how-to-send-emails-on-server-with-25-465-587-outbound-blocked/86309/9 "2024-06-08T12:37:32Z")

</div>

This topic was automatically closed after 2233 days. New replies are no longer allowed.
