I am currently testing and setting up an email service system.
I just need to be able to receive emails , but no need to send email.
my dns
mail.xxx.comis ping successful, it can get bytes from IP address.My online-server had open port: 443,25, 587
I used docker to deploy my rails server.
Dockers proxy ports is: 443,25, 587 and rails server port is 3005
My
ApplicationMailboxandcomments_mailboxlike this:
class ApplicationMailbox < ActionMailbox::Base
#routing /@xxx.com/i => :comments
routing :all => :comments
end
class CommentsMailbox < ApplicationMailbox
def process
p mail.decoded
rescue => e
p e
end
end
- My nginx configuration is like this:
user xxx;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
...
location ~ /(api|rails)/ {
proxy_pass http://127.0.0.1:3005;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header HTTP_X_FORWARDED_FOR $remote_addr;
proxy_set_header NginX-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
autoindex_exact_size on;
autoindex_localtime on;
proxy_read_timeout 240s;
}
...
}
When I send email from gmail account to ydddd@xxx.com (my custom emails), I can't receive email in production.
What's wrong with it? Could you please help me? Thanks so much~~
Supplement:
I had read this answer and article:
https://stackoverflow.com/questions/58326314/postfix-setup-for-action-mailbox/61629911#61629911
https://thedevpost.com/blog/setup-action-mailbox-with-postfix-part-2/
It is greate.
but I'm sorry that I also cannot receive the email.
This is my custom cofiguration:
# /usr/local/bin/email_forwarder.sh
#!/bin/sh
export HOME=/home/airdrop
export PATH=/home/airdrop/.rvm/bin
export RVM_ROOT=/home/airdrop/.rvm/bin/rvm
cd /home/airdrop && bin/rails action_mailbox:ingress:postfix URL='http://localhost:3005/rails/action_mailbox/relay/inbound_emails' INGRESS_PASSWORD='xxxxxxx'
# /etc/postfix/virtual_aliases
@xxx.com airdrop@xxx.com
# /etc/postfix/transport
xxx.com forward_to_rails:
# /etc/postfix/master.cf
...
forward_to_rails unix - n n - - pipe
flags=Xhq user=airdrop:airdrop argv=/usr/local/bin/email_forwarder.sh
${nexthop} ${user}
Then I restart the postfix sudo service postfix restart, it runs ok.
When I send Email from gmail to ydddd@xxx.com (my custom emails), I can not receive any mail.log, also can not reach to my rails action mailer.
What's wrong with it? Could you please help me? Thanks so much~~