SMTP Configuration of Swiftmailer Symfony2, Servage - smtp

Please i want to know how to configure the SMTP for Swiftmailer in Symfony2.
I use FOSUserBundle, and i enabled the activation by email after registration, but after registration i get the message that says the activation email has been sent, without receiving any mail.
i use Servage.net hosting, and i have tried this configuration :
app/config/config.yml
# Swiftmailer Configuration
swiftmailer:
transport: smtp
host: smtp1.servage.net
auth_mode: login
username: webmaster#myEmailAtServage.com
password: mypassword
port : 25
Thanks.

Thanks, now the Swiftmailer works with this configuration:
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
port : %mailer_port%
encryption: ssl
auth_mode: login
parameters.ini
mailer_transport="smtp"
mailer_host="smtp2.servage.net"
mailer_user="me#mywebsite.com"
mailer_password="myPassword"
mailer_port=465

You can try smtp2 with ssl/tls
From the servage wiki: https://www.servage.net/wiki/SMTP_server
The mail server smtp2.servage.net has support for TLS and SSL, using standard SSL port 465

Related

Can I configure worked EJabberd without using 5269 port? blocked by provider

Is it possible to make ejabberd.yml and ejabberdctl.cfg files to use another ports or except using port 5269?
You can use these steps:
listen:
...
port: 3478
transport: udp
module: ejabberd_stun
port: 3478
module: ejabberd_stun
port: 5349
module: ejabberd_stun
certfile: /etc/ejabberd/server.pem
...
Example:
https://docs.ejabberd.im/admin/configuration/listen/
Your network provider blocks port 5269?
It's the standard port number for XMPP server-2-server connections.
When some user in a remote XMPP server wants to chat with somebody in your ejabberd server, by default they will attempt to connect to your ejabberd on port number 5269, so your ejabberd should be listening in port 5269, and that port should not be blocked... bad luck!
Of course, you can edit that 5269 number in ejabberd.yml, put whatever like 555269, and ejabberd will listen in that different port number... but remote servers will still attempt to contact ejabberd on port 5269, so that connection will fail!
Searching for some way to tell remote XMPP servers to contact you to a different port number, it seems you can set up SRV DNS records when you run s2s over a custom port, see https://prosody.im/doc/s2s and https://prosody.im/doc/dns

Can I use fail2ban behind router for mail server?

I'm running Docker on NAS in a home network behind a FritzBox router. Mail and web server are dockerized, external ports 22, 80, 443 are forwarded to the respektive ports on the NAS, Traefik serves as reverse proxy.
While traefik works fine thanks for X-Forwarded headers and HTTP 1.1 Host headers, I'm unable to setup fail2ban to block excessive login attempts of rogue clients. Thanks to NAT on the router, the mail container always seems the router's IP as source.
Server logs look like this:
dovecot: auth: passwd-file(luv5#xn--...,172.19.0.1): unknown user (SHA1 of given password: 63f39e)
postfix/smtpd[1118]: warning: unknown[172.19.0.1]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
postfix/smtpd[1118]: disconnect from unknown[172.19.0.1] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4
postfix/smtpd[1028]: warning: unknown[172.19.0.1]: SASL LOGIN authentication failed: Connection lost to authentication server
postfix/smtpd[1028]: disconnect from unknown[172.19.0.1] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4
postfix/smtpd[1066]: warning: unknown[172.19.0.1]: SASL LOGIN authentication failed: Connection lost to authentication server
postfix/smtpd[1066]: disconnect from unknown[172.19.0.1] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4
dovecot: auth: passwd-file(mathew#xn--...,172.19.0.1): unknown user (SHA1 of given password: 011c94)
postfix/smtpd[2295]: warning: unknown[172.19.0.1]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
postfix/smtpd[2295]: disconnect from unknown[172.19.0.1] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4
postfix/postscreen[1020]: CONNECT from [172.19.0.1]:36922 to [172.19.0.11]:25
postfix/postscreen[1020]: PASS OLD [172.19.0.1]:36922
postfix/smtpd[1118]: connect from unknown[172.19.0.1]
postfix/postscreen[1020]: CONNECT from [172.19.0.1]:36948 to [172.19.0.11]:25
dovecot: auth: passwd-file(psycho#xn--...,172.19.0.1): unknown user (SHA1 of given password: 7c4a8d)
postfix/postscreen[1020]: CONNECT from [172.19.0.1]:36950 to [172.19.0.11]:25
postfix/smtpd[1118]: warning: unknown[172.19.0.1]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
postfix/smtpd[1118]: disconnect from unknown[172.19.0.1] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4
postfix/postscreen[1020]: CONNECT from [172.19.0.1]:36958 to [172.19.0.11]:25
postfix/postscreen[1020]: PASS OLD [172.19.0.1]:36948
postfix/smtpd[2295]: connect from unknown[172.19.0.1]
postfix/postscreen[1020]: PASS OLD [172.19.0.1]:36950
postfix/smtpd[1066]: connect from unknown[172.19.0.1]
Is there anything that can be done to get fail2ban to block based on IP address for SMTP behind NAT (except for using an "exposed host")?
Thanks to NAT on the router, the mail container always seems the router's IP as source.
If you're able at all to capture from log/journal an originated IP (or something else identifying the intruder) in the filter, you could:
write own failregex or filter capturing forwarded IP, session or username (something you can use as ID to identify intruder), then ...
either try to implement a solution described in our wiki - How to ban something other as host (IP address), like user or mail, etc.
or write some actions like https://github.com/fail2ban/fail2ban/blob/0.10/config/action.d/nginx-block-map.conf (banning intruder resp. rejecting its connection on web-server or mail-service side)
or write your own action to notify your proxying service, in order to ban the originated IP on the other side (no idea traefik has something like that, but there is still open RFE about that - https://github.com/containous/traefik/issues/4026).
Also note similar question - How to implement fail2ban with Traefik

redmine email configuration with smtp

I installed Redmine 2.6.1.1 using Bitnami on Win 7, but couldn't figure out why redmine cannot send any email. I edited the configuration.yml file under \redmine-2.6.1-1\apps\redmine\htdocs\config and tried to send a test mail via both Gmail and our own e-mail server, but it didn't work.
My configuration.yml file is just like below:
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: smtp.gmail.com
port: 587
domain: smtp.gmail.com
authentication: :plain
user_name: "someusername#gmail.com"
password: "somepassword"
In this configuration the error is:
an error occurred while sending mail (a socket operation was attempted to an unreachable network. - connect (2))
If I change the address and domain values with IP addresses then the error becomes:
an error occurred while sending mail (Permission denied - connect(2))
If I try to configure it with the values of our own mail server, then I still get the second error (permission denied).
I tried it in another PC and it worked. However, the same configuration in the old PC, it does not work. 2 PCs are in the same network and the only difference between 2 installations is that I did not configure mail settings during the Bitnami installtion in the old machine. After the installation was completed, I modified configuration.yml. However, in the new PC, I configured it during the installation.
I could solve the problem finally. The reason is McAfee security. When I disable McAfee's "Access Protection" task, it worked without any problem.

SMTP MAIL FROM AUTH= format to connect to gmail

I have an older PHP system that uses SMTP commands for mail. We are switching over to gmail and I need to authenticate. I can connect to the server. Unfortunately, I get a 530-5.5.1 Authentication Required. Learn more at" message when I send the MAIL FROM command in my PHP code.
if (fputs($this->Socket, "MAIL FROM: \"admin\" <admin#yourdomain.com>\r\n")<0){
I cannot find a clear example of adding authentication. I read at http://www.faqs.org/rfcs/rfc2554.html that I must add AUTH= to my MAIL FROM command. I am having troubles interpretting what to put in the AUTH=
Examples:
C: MAIL FROM:<e=mc2#example.com> AUTH=e+3Dmc2#example.com
S: 250 OK
Do you know the format of authentication?
There are several ways to do SMTP authentication, but one of them is to use the SMTP AUTH LOGIN command. The transcript of the session would look like this:
host: 220 banner_here
client: EHLO StephaniePC
host: 250-name.of.host hello [clientip], pleased to meet you
host: 250-AUTH LOGIN PLAIN
host: 250 OK
client: AUTH LOGIN
host: 334 VXNlcm5hbWU6
client: am9lc21pdGg=
host: 334 UGFzc3dvcmQ6
client: bGV0bWVpbg0K
host: 235 2.7.0 Authentication successful
client: MAIL FROM: <sender#senderdomain.tld>
host: 250 2.1.0 Ok
client: RCPT TO: <recipient#recipientdomain.tld>
host: 250 2.1.0 Ok
client: DATA
host: 354 End data with <CR><LF>.<CR><LF>
....
The encoded strings that you see above are base64 encoded. If you have a mail client that is capable of logging, you can try sending a message through gmail, and the transcript of the session should look like the transcript above.
FYI, instead of writing code yourself to do SMTP authentication, you might want to use phpmailer. phpmailer can do SMTP authentication, and it's very lightweight and easy to use.

mysql connect to remote database specified by ip and server name

Trying to connect to a database using the mysql2 gem through a VPN.
I'm connected to the VPN, and can access secure pages via browser. I have the following info:
server: ###-*********
ip: ###.###.##.###
port: ####
username: ********
password: ********
schema: ***********_***
And the gem wants:
username (check)
password (check)
host (?)
port (check)
database (?)
I've tried putting the ip as the host and using schema and server for database, but it won't connect.