مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-03-03 06:14:06 +00:00
Compare commits
27 الالتزامات
| المؤلف | SHA1 | التاريخ | |
|---|---|---|---|
|
|
83fef0e8a0 | ||
|
|
0dc6824a8f | ||
|
|
6bace2c905 | ||
|
|
9f0697f194 | ||
|
|
d4aebac3cb | ||
|
|
c60c69db18 | ||
|
|
889e7bc9cf | ||
|
|
152633adfe | ||
|
|
b77139f5cf | ||
|
|
f114a8d8b9 | ||
|
|
d22237d0ec | ||
|
|
51e3a1fb5e | ||
|
|
3c17f1690c | ||
|
|
5b04faca39 | ||
|
|
2053a1dc1d | ||
|
|
a0c87e7bf1 | ||
|
|
f305fdd2f8 | ||
|
|
e49ae56d27 | ||
|
|
8dd5df6e8a | ||
|
|
d37ded12f5 | ||
|
|
1ff93194f5 | ||
|
|
aede11bc15 | ||
|
|
9f4160ff5c | ||
|
|
cc65d781a4 | ||
|
|
1beb30869a | ||
|
|
e1c355919b | ||
|
|
ea10ae18f1 |
2
.ruby-version
Normal file
2
.ruby-version
Normal file
@@ -0,0 +1,2 @@
|
||||
2.6.9
|
||||
|
||||
21
CHANGELOG.md
21
CHANGELOG.md
@@ -2,6 +2,27 @@
|
||||
|
||||
This file contains all the latest changes and updates to Postal.
|
||||
|
||||
## 2.1.2
|
||||
|
||||
### Features
|
||||
|
||||
- support for AMQPS for rabbitmq connections ([9f0697](https://github.com/postalserver/postal/commit/9f0697f194209f5fae5e451ba8fb888413fe37fa))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- retry connections without SSL when SSL issue is encountered during smtp sending ([0dc682](https://github.com/postalserver/postal/commit/0dc6824a8f0315ea42b08f7e6812b821b62489c9))
|
||||
|
||||
## 2.1.1
|
||||
|
||||
### Features
|
||||
|
||||
- allow @ and % in webhook urls ([c60c69](https://github.com/postalserver/postal/commit/c60c69db1800775776da4c28c68001f230fe5888))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- fixes broken styling on errors ([a0c87e](https://github.com/postalserver/postal/commit/a0c87e7bf16a19f06c13797e3329a4fed91370a1))
|
||||
- use the Postal logger system for the rails log ([5b04fa](https://github.com/postalserver/postal/commit/5b04faca39c69757bd7d695b82984f8b4a41cac3))
|
||||
|
||||
## 2.1.0
|
||||
|
||||
### Features
|
||||
|
||||
6
Gemfile
6
Gemfile
@@ -1,7 +1,7 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'rails', '= 5.2.6'
|
||||
gem 'rails', '= 5.2.6.2'
|
||||
gem 'mysql2'
|
||||
gem 'puma', '~> 4'
|
||||
gem 'puma'
|
||||
gem 'turbolinks', '~> 5'
|
||||
gem 'haml'
|
||||
gem 'nifty-utils'
|
||||
@@ -22,13 +22,13 @@ gem 'basic_ssl'
|
||||
gem 'clockwork'
|
||||
gem 'encrypto_signo'
|
||||
gem 'nio4r'
|
||||
gem 'mongo'
|
||||
gem 'sentry-raven'
|
||||
gem 'gelf'
|
||||
gem 'moonrope'
|
||||
gem 'jwt'
|
||||
gem 'highline', :require => false
|
||||
gem 'resolv', '~> 0.2.1'
|
||||
gem 'dotenv-rails'
|
||||
|
||||
group :development, :assets do
|
||||
gem 'sass-rails', '~> 5.0'
|
||||
|
||||
119
Gemfile.lock
119
Gemfile.lock
@@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: https://github.com/mikel/mail.git
|
||||
revision: 51c05e0aea01d9a265305a1ac8b853b00ef1299d
|
||||
revision: 873aa3876efb372b9a0bb7319fe60a994cedfd05
|
||||
branch: 2-7-stable
|
||||
specs:
|
||||
mail (2.7.2.edge)
|
||||
@@ -9,43 +9,43 @@ GIT
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.2.6)
|
||||
actionpack (= 5.2.6)
|
||||
actioncable (5.2.6.2)
|
||||
actionpack (= 5.2.6.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.6)
|
||||
actionpack (= 5.2.6)
|
||||
actionview (= 5.2.6)
|
||||
activejob (= 5.2.6)
|
||||
actionmailer (5.2.6.2)
|
||||
actionpack (= 5.2.6.2)
|
||||
actionview (= 5.2.6.2)
|
||||
activejob (= 5.2.6.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.6)
|
||||
actionview (= 5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
actionpack (5.2.6.2)
|
||||
actionview (= 5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
actionview (5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
activejob (5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
activerecord (5.2.6)
|
||||
activemodel (= 5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
activemodel (5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
activerecord (5.2.6.2)
|
||||
activemodel (= 5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.6)
|
||||
actionpack (= 5.2.6)
|
||||
activerecord (= 5.2.6)
|
||||
activestorage (5.2.6.2)
|
||||
actionpack (= 5.2.6.2)
|
||||
activerecord (= 5.2.6.2)
|
||||
marcel (~> 1.0.0)
|
||||
activesupport (5.2.6)
|
||||
activesupport (5.2.6.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
@@ -61,7 +61,6 @@ GEM
|
||||
execjs
|
||||
basic_ssl (1.0.3)
|
||||
bcrypt (3.1.12)
|
||||
bson (4.3.0)
|
||||
builder (3.2.4)
|
||||
bunny (2.14.4)
|
||||
amq-protocol (~> 2.3, >= 2.3.0)
|
||||
@@ -83,6 +82,10 @@ GEM
|
||||
database_cleaner (1.7.0)
|
||||
deep_merge (1.2.1)
|
||||
diff-lcs (1.3)
|
||||
dotenv (2.7.6)
|
||||
dotenv-rails (2.7.6)
|
||||
dotenv (= 2.7.6)
|
||||
railties (>= 3.2)
|
||||
dynamic_form (1.1.4)
|
||||
encrypto_signo (1.0.0)
|
||||
erubi (1.10.0)
|
||||
@@ -94,19 +97,19 @@ GEM
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.15.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.9.25)
|
||||
ffi (1.15.5)
|
||||
foreman (0.85.0)
|
||||
thor (~> 0.19.1)
|
||||
gelf (3.0.0)
|
||||
json
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
globalid (1.0.0)
|
||||
activesupport (>= 5.0)
|
||||
haml (5.1.2)
|
||||
temple (>= 0.8.0)
|
||||
tilt
|
||||
hashie (3.6.0)
|
||||
highline (2.0.0)
|
||||
i18n (1.8.10)
|
||||
i18n (1.9.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jquery-rails (4.3.3)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
@@ -126,16 +129,14 @@ GEM
|
||||
activerecord
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-core (1.2.1)
|
||||
loofah (2.10.0)
|
||||
loofah (2.14.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
marcel (1.0.1)
|
||||
marcel (1.0.2)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.1.0)
|
||||
mini_portile2 (2.6.1)
|
||||
minitest (5.14.4)
|
||||
mongo (2.6.2)
|
||||
bson (>= 4.3.0, < 5.0.0)
|
||||
mini_mime (1.1.2)
|
||||
mini_portile2 (2.7.1)
|
||||
minitest (5.15.0)
|
||||
moonrope (2.0.2)
|
||||
deep_merge (~> 1.0)
|
||||
json
|
||||
@@ -147,36 +148,36 @@ GEM
|
||||
activerecord (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.12.5)
|
||||
mini_portile2 (~> 2.6.1)
|
||||
nokogiri (1.13.1)
|
||||
mini_portile2 (~> 2.7.0)
|
||||
racc (~> 1.4)
|
||||
puma (4.3.10)
|
||||
puma (5.6.2)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.6.0)
|
||||
rack (2.2.3)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.6)
|
||||
actioncable (= 5.2.6)
|
||||
actionmailer (= 5.2.6)
|
||||
actionpack (= 5.2.6)
|
||||
actionview (= 5.2.6)
|
||||
activejob (= 5.2.6)
|
||||
activemodel (= 5.2.6)
|
||||
activerecord (= 5.2.6)
|
||||
activestorage (= 5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
rails (5.2.6.2)
|
||||
actioncable (= 5.2.6.2)
|
||||
actionmailer (= 5.2.6.2)
|
||||
actionpack (= 5.2.6.2)
|
||||
actionview (= 5.2.6.2)
|
||||
activejob (= 5.2.6.2)
|
||||
activemodel (= 5.2.6.2)
|
||||
activerecord (= 5.2.6.2)
|
||||
activestorage (= 5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.6)
|
||||
railties (= 5.2.6.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
rails-html-sanitizer (1.4.2)
|
||||
loofah (~> 2.3)
|
||||
railties (5.2.6)
|
||||
actionpack (= 5.2.6)
|
||||
activesupport (= 5.2.6)
|
||||
railties (5.2.6.2)
|
||||
actionpack (= 5.2.6.2)
|
||||
activesupport (= 5.2.6.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
@@ -224,9 +225,9 @@ GEM
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.2)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets-rails (3.4.2)
|
||||
actionpack (>= 5.2)
|
||||
activesupport (>= 5.2)
|
||||
sprockets (>= 3.0.0)
|
||||
temple (0.8.2)
|
||||
thor (0.19.4)
|
||||
@@ -259,6 +260,7 @@ DEPENDENCIES
|
||||
clockwork
|
||||
coffee-rails (~> 4.2)
|
||||
database_cleaner
|
||||
dotenv-rails
|
||||
dynamic_form
|
||||
encrypto_signo
|
||||
factory_bot_rails (~> 4.0)
|
||||
@@ -271,14 +273,13 @@ DEPENDENCIES
|
||||
jwt
|
||||
kaminari
|
||||
mail!
|
||||
mongo
|
||||
moonrope
|
||||
mysql2
|
||||
nifty-utils
|
||||
nilify_blanks
|
||||
nio4r
|
||||
puma (~> 4)
|
||||
rails (= 5.2.6)
|
||||
puma
|
||||
rails (= 5.2.6.2)
|
||||
resolv (~> 0.2.1)
|
||||
rspec
|
||||
rspec-rails
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
app_name: Postal
|
||||
log_path: /tmp/postal/procodile.log
|
||||
pid_root: /tmp/postal/pids
|
||||
processes:
|
||||
web:
|
||||
restart_mode: usr1
|
||||
smtp:
|
||||
restart_mode: usr1
|
||||
worker:
|
||||
restart_mode: start-term
|
||||
cron:
|
||||
restart_mode: term-start
|
||||
@@ -8,4 +8,3 @@
|
||||
* [Installation Instructions](https://docs.postalserver.io/install/prerequisites)
|
||||
* [FAQs](https://docs.postalserver.io/welcome/faqs) & [Features](https://docs.postalserver.io/welcome/feature-list)
|
||||
* [Ask for help](https://github.com/postalserver/postal/discussions)
|
||||
* [Slack Channel](https://slack.k.io)
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
color:$orange;
|
||||
padding:15px;
|
||||
box-shadow:0 0 10px lighten($red, 30%);
|
||||
background:image-url('animals/fox.svg') #fff no-repeat 15px 15px / 50px;
|
||||
padding-left:75px;
|
||||
background:#fff;
|
||||
border-radius:4px;
|
||||
line-height:1.5;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Webhook < ApplicationRecord
|
||||
has_many :webhook_requests
|
||||
|
||||
validates :name, :presence => true
|
||||
validates :url, :presence => true, :format => {:with => /\Ahttps?\:\/\/[a-z0-9\-\.\_\?\=\&\/\+:]+\z/i, :allow_blank => true}
|
||||
validates :url, :presence => true, :format => {:with => /\Ahttps?\:\/\/[a-z0-9\-\.\_\?\=\&\/\+:%@]+\z/i, :allow_blank => true}
|
||||
|
||||
scope :enabled, -> { where(:enabled => true) }
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
%p.pageContent__subTitle Incoming Spam Threshold
|
||||
%p.pageContent__text.u-margin
|
||||
The main spam threshold is what determines whether a message is spam or not. How incoming
|
||||
messages that are detected as spam is determined by the route which the incoming message was
|
||||
sent to. You can choose between marking the message as spam and sending it on to your endpoint,
|
||||
putting it into quarantine (holding it until manually released) or just failing it.
|
||||
messages that are detected as spam are processed is determined by the route which the incoming
|
||||
message was sent to. You can choose between marking the message as spam and sending it on to
|
||||
your endpoint, putting it into quarantine (holding it until manually released) or just failing it.
|
||||
%p= f.text_field :spam_threshold, :type => :range, :class => 'spamRange', :min => -10, :max => 25, :step => 0.5, :data => {:update => "js-spam-threshold-text"}
|
||||
%p.spamRangeLabel Threshold is currently <b class='js-spam-threshold-text'>#{@server.spam_threshold}</b>
|
||||
|
||||
.u-margin
|
||||
%p.pageContent__subTitle Incoming Spam Failure Threshold
|
||||
%p.pageContent__text.u-margin
|
||||
Any messages which are over your spam failure threshold will failed immediately. This is used
|
||||
to catch messages that we very sure at spam to avoid sending them needless around the place.
|
||||
Any messages which are over your spam failure threshold will fail immediately. This is used
|
||||
to catch messages that we are very sure are spam to avoid needlessly sending them around the place.
|
||||
%p= f.text_field :spam_failure_threshold, :type => :range, :class => 'spamRange spamRange--hot', :min => 10, :max => 50, :step => 0.5, :data => {:update => "js-spam-failure-threshold-text"}
|
||||
%p.spamRangeLabel Threshold is currently <b class='js-spam-failure-threshold-text'>#{@server.spam_failure_threshold}</b>
|
||||
|
||||
|
||||
9
bin/dev
Executable file
9
bin/dev
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! command -v foreman &> /dev/null
|
||||
then
|
||||
echo "Installing foreman..."
|
||||
gem install foreman
|
||||
fi
|
||||
|
||||
foreman start -f Procfile.dev
|
||||
24
bin/postal
24
bin/postal
@@ -66,23 +66,23 @@ case "$1" in
|
||||
echo
|
||||
echo "Server components:"
|
||||
echo
|
||||
echo -e " * \e[35mweb-server\e[0m - run the web server"
|
||||
echo -e " * \e[35msmtp-server\e[0m - run the SMTP server"
|
||||
echo -e " * \e[35mworker\e[0m - run a worker"
|
||||
echo -e " * \e[35mcron\e[0m - run the cron process"
|
||||
echo -e " * \e[35mrequeuer\e[0m - run the message requeuer"
|
||||
echo -e " * \033[35mweb-server\033[0m - run the web server"
|
||||
echo -e " * \033[35msmtp-server\033[0m - run the SMTP server"
|
||||
echo -e " * \033[35mworker\033[0m - run a worker"
|
||||
echo -e " * \033[35mcron\033[0m - run the cron process"
|
||||
echo -e " * \033[35mrequeuer\033[0m - run the message requeuer"
|
||||
echo
|
||||
echo "Setup/upgrade tools:"
|
||||
echo
|
||||
echo -e " * \e[32minitialize\e[0m - create and load the DB schema"
|
||||
echo -e " * \e[32mupgrade\e[0m - upgrade the DB schema"
|
||||
echo -e " * \033[32minitialize\033[0m - create and load the DB schema"
|
||||
echo -e " * \033[32mupgrade\033[0m - upgrade the DB schema"
|
||||
echo
|
||||
echo "Other tools:"
|
||||
echo
|
||||
echo -e " * \e[34mversion\e[0m - show the current Postal version"
|
||||
echo -e " * \e[34mmake-user\e[0m - create a new global admin user"
|
||||
echo -e " * \e[34mdefault-dkim-record\e[0m - display the default DKIM record"
|
||||
echo -e " * \e[34mconsole\e[0m - open an interactive console"
|
||||
echo -e " * \e[34mtest-app-smtp\e[0m - send a test message through Postal"
|
||||
echo -e " * \033[34mversion\033[0m - show the current Postal version"
|
||||
echo -e " * \033[34mmake-user\033[0m - create a new global admin user"
|
||||
echo -e " * \033[34mdefault-dkim-record\033[0m - display the default DKIM record"
|
||||
echo -e " * \033[34mconsole\033[0m - open an interactive console"
|
||||
echo -e " * \033[34mtest-app-smtp\033[0m - send a test message through Postal"
|
||||
echo
|
||||
esac
|
||||
|
||||
@@ -32,5 +32,7 @@ module Postal
|
||||
# Load the tracking server middleware
|
||||
require 'postal/tracking_middleware'
|
||||
config.middleware.use Postal::TrackingMiddleware
|
||||
|
||||
config.logger = Postal.logger_for(:rails)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,8 +9,3 @@ require_relative '../lib/postal/config'
|
||||
Postal.check_config!
|
||||
|
||||
ENV['RAILS_ENV'] = Postal.config.rails&.environment || 'development'
|
||||
|
||||
if ENV['PROC_NAME']
|
||||
$0="[postal] #{ENV['PROC_NAME']}"
|
||||
end
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ message_db:
|
||||
rabbitmq:
|
||||
host: 127.0.0.1
|
||||
port: 5672
|
||||
tls: false
|
||||
verify_peer: true
|
||||
tls_ca_certificates:
|
||||
- /etc/ssl/certs/ca-certificates.crt
|
||||
username: postal
|
||||
password:
|
||||
vhost: /postal
|
||||
|
||||
@@ -2,12 +2,8 @@ require_relative '../lib/postal/config'
|
||||
threads_count = Postal.config.web_server&.max_threads&.to_i || 5
|
||||
threads threads_count, threads_count
|
||||
bind_address = Postal.config.web_server&.bind_address || '127.0.0.1'
|
||||
bind_port = ENV['PORT'] || Postal.config.web_server&.port&.to_i || 5000
|
||||
bind_port = Postal.config.web_server&.port&.to_i || ENV['PORT'] || 5000
|
||||
bind "tcp://#{bind_address}:#{bind_port}"
|
||||
environment Postal.config.rails&.environment || 'development'
|
||||
prune_bundler
|
||||
quiet false
|
||||
|
||||
if ENV['APP_ROOT']
|
||||
directory ENV['APP_ROOT']
|
||||
end
|
||||
|
||||
@@ -54,7 +54,17 @@ module Postal
|
||||
end
|
||||
|
||||
def self.config_file_path
|
||||
@config_file_path ||= File.join(config_root, 'postal.yml')
|
||||
@config_file_path ||= begin
|
||||
if env == 'default'
|
||||
File.join(config_root, 'postal.yml')
|
||||
else
|
||||
File.join(config_root, "postal.#{env}.yml")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.env
|
||||
@env ||= ENV.fetch('POSTAL_ENV', 'default')
|
||||
end
|
||||
|
||||
def self.yaml_config
|
||||
|
||||
@@ -16,6 +16,9 @@ module Postal
|
||||
conn = Bunny.new(
|
||||
:hosts => bunny_host,
|
||||
:port => Postal.config.rabbitmq&.port || 5672,
|
||||
:tls => Postal.config.rabbitmq&.tls || false,
|
||||
:verify_peer => Postal.config.rabbitmq&.verify_peer || true,
|
||||
:tls_ca_certificates => Postal.config.rabbitmq&.tls_ca_certificates || [ "/etc/ssl/certs/ca-certificates.crt" ],
|
||||
:username => Postal.config.rabbitmq&.username || 'guest',
|
||||
:password => Postal.config.rabbitmq&.password || 'guest',
|
||||
:vhost => Postal.config.rabbitmq&.vhost || nil
|
||||
|
||||
@@ -46,13 +46,16 @@ module Postal
|
||||
end
|
||||
next
|
||||
end
|
||||
|
||||
smtp_client = Net::SMTP.new(hostname, port)
|
||||
smtp_client.open_timeout = Postal.config.smtp_client.open_timeout
|
||||
smtp_client.read_timeout = Postal.config.smtp_client.read_timeout
|
||||
|
||||
if @source_ip_address
|
||||
# Set the source IP as appropriate
|
||||
smtp_client.source_address = ip_type == :aaaa ? @source_ip_address.ipv6 : @source_ip_address.ipv4
|
||||
end
|
||||
|
||||
case ssl_mode
|
||||
when 'Auto'
|
||||
smtp_client.enable_starttls_auto(self.class.ssl_context_without_verify)
|
||||
@@ -63,9 +66,17 @@ module Postal
|
||||
else
|
||||
# Nothing
|
||||
end
|
||||
|
||||
smtp_client.start(@source_ip_address ? @source_ip_address.hostname : self.class.default_helo_hostname)
|
||||
log "Connected to #{@remote_ip}:#{port} (#{hostname})"
|
||||
|
||||
rescue => e
|
||||
if e.is_a?(OpenSSL::SSL::SSLError) && ssl_mode == 'Auto'
|
||||
log "SSL error (#{e.message}), retrying without SSL"
|
||||
ssl_mode = nil
|
||||
retry
|
||||
end
|
||||
|
||||
log "Cannot connect to #{@remote_ip}:#{port} (#{hostname}) (#{e.class}: #{e.message})"
|
||||
@connection_errors << e.message unless @connection_errors.include?(e.message)
|
||||
smtp_client.disconnect rescue nil
|
||||
|
||||
@@ -105,7 +105,10 @@ module Postal
|
||||
private
|
||||
|
||||
def resolve_hostname
|
||||
@hostname = Resolv.new.getname(@ip_address) rescue @ip_address
|
||||
Resolv::DNS.open do |dns|
|
||||
dns.timeouts = [10,5]
|
||||
@hostname = dns.getname(@ip_address) rescue @ip_address
|
||||
end
|
||||
end
|
||||
|
||||
def proxy(data)
|
||||
|
||||
@@ -13,7 +13,7 @@ module Postal
|
||||
user.email_address = cli.ask("E-Mail Address".ljust(20, ' ') + ": ")
|
||||
user.first_name = cli.ask("First Name".ljust(20, ' ') + ": ")
|
||||
user.last_name = cli.ask("Last Name".ljust(20, ' ') + ": ")
|
||||
user.password = cli.ask("Initial Password:".ljust(20, ' ') + ": ") { |value| value.echo = '*' }
|
||||
user.password = cli.ask("Initial Password".ljust(20, ' ') + ": ") { |value| value.echo = '*' }
|
||||
|
||||
block.call(user) if block_given?
|
||||
if user.save
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
web:
|
||||
host: postal.example.com
|
||||
protocol: https
|
||||
|
||||
general:
|
||||
use_ip_pools: false
|
||||
|
||||
main_db:
|
||||
host: 127.0.0.1
|
||||
username: root
|
||||
password:
|
||||
database: postal_test
|
||||
|
||||
message_db:
|
||||
host: 127.0.0.1
|
||||
username: root
|
||||
password:
|
||||
prefix: postal_test
|
||||
|
||||
rabbitmq:
|
||||
host: 127.0.0.1
|
||||
username: guest
|
||||
password: guest
|
||||
vhost:
|
||||
|
||||
smtp_server:
|
||||
port: 2525
|
||||
|
||||
dns:
|
||||
mx_records:
|
||||
- mx.postal.example.com
|
||||
smtp_server_hostname: postal.example.com
|
||||
spf_include: spf.postal.example.com
|
||||
return_path: rp.postal.example.com
|
||||
route_domain: routes.postal.example.com
|
||||
track_domain: track.postal.example.com
|
||||
|
||||
smtp:
|
||||
host: 127.0.0.1
|
||||
port: 2525
|
||||
username:
|
||||
password:
|
||||
from_name: Postal
|
||||
from_address: postal@yourdomain.com
|
||||
|
||||
rails:
|
||||
environment: test
|
||||
secret_key: c3ed0d4723a5d08f8cdb03571ddec8366da74db114f5419187343632e9c0c0110da177c0cf79e6605a4ccfff6f2d9e716d99b6525401ad9c181466b57a1901ffeacb023d05c9ce69838dd826f54e29c846e9e3231697c6749648a9c706df20b50bec1d7ef81b0dbd91410b314c44a4c0cf74741df2de9f5bb144026a6f99954c
|
||||
@@ -1,15 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXgIBAAKBgQC/Af1LGsg/xdpdLjIaxVhQm3qjKNrWQh+divUV9eLCFta/s5Qs
|
||||
Axs2+jf40IjpORn9507mtFwNPcauNyfUH7/bNxfAb65L3c2GWxVu/Cp4tg9yYVpz
|
||||
9vvNEsQh/AWrhjrFcc1DpyWUFeY80ASBHGAJQe1y+iFMQVQAJzXcyUNwJwIDAQAB
|
||||
AoGAMcDj6J9WT/5KjgENfhmvknedb0iiEDNzJsdeZdUBtwrZ719oljpM6XouADrZ
|
||||
nt6H3bJVxBRw8eYIjbLCRifrAkv0dmFOPbrZBd8q7bFSRlyc5OeD6aKLW95szrpx
|
||||
AnAEPb1ojfvOAyAA2407GZjuPQrRjncT1tZx56xwIU2n0DECQQD6b1wtad+akE0k
|
||||
ry54Wd/iaaM/pguh2dUyphDrCKzQ3fFeLw0WPe/j+f5hLcXaWNJWiOwa+MPUpEnE
|
||||
B1SCA7O/AkEAw0CRZp+smFD2clPDiGtNbXW1ZF2TzLZhHzntYv3KpCqzJna8vx+I
|
||||
gwXCUrnleMRJdDV+mWvlptDDJOAi2Oe9mQJBAMjTwpyceXbOXz6ayO40TGiZhBNH
|
||||
ia56LBDYwVppc4RvZt67Zog+lQBB+q9dcHtfnRVN6eDbOtdsA8eShT9ZzqsCQQCe
|
||||
uTJ6FnucJtTxA58EmxYKUZHv0RKBbBFv7QtJWb8NzZhtQEEXrW6v9FKQJYahsg90
|
||||
ZLhRyCCch0DcDUjGwzyhAkEAh8CC37iLLBCHpxxrsQ/l+/c9TX0c+PbcZSRrZ54X
|
||||
l3yZis66MmhaOaeKVQ7rY+hS9/v+PHBY4HCpCkqjYV/bIQ==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@@ -1,4 +1,4 @@
|
||||
ENV['POSTAL_CONFIG_ROOT'] ||= File.expand_path('../config', __FILE__)
|
||||
ENV['POSTAL_ENV'] = 'test'
|
||||
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rspec/rails'
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم