Odoo : Outcomin Mail Server - python-2.7

I use Odoo 10 installed on VM , i have this problem with Outcoming Mail Server
enter image description here

Hello #Koussay Abdouli
Please change the port to 465 and check again.
Configuration:
Gmail Server: smtp.gmail.com
Port: SSL – 465 / STARTTLS – 587

You should put 465 into the smtp port used by google:
Then create google application password and insert those informations into Security and Authentication menu:

Related

Connection timed out while sending email from Roundcube Webmail v1.4.11 ( iRedMail )

I am trying to setup a email server on Google clou for which I have used iRedMail. I have followed this link to setup. There was no error in logs while sending email to this email server but when I try to send from the UI to my email ID it is giving me following error in logs. ( /var/log/mail.log ).
Dec 8 10:19:36 comm postfix/smtp[4142]: connect to mail.tinydef.com[157.230.67.25]:25: Connection timed out
Dec 8 10:19:36 comm postfix/smtp[4142]: 4J8CnP4ND5z3ygl: to=<jamir46881#tinydef.com>, relay=none, delay=31, delays=0.02/0.03/31/0, dsn=4.4.1, status=deferred (connect to mail.tinydef.com[157.230.67.25]:25: Connection timed out)
I am aware that port 25 is blocked on GCP. Just trying to figure a way out from this situation. Is there any configuration that can be tweaked to change port 25 to some other port ?
You cannot send mail to external IP addresses on port 25 from instances in Google Cloud. There is no appeal process to change this policy.
Sending email from an instance
To function as a mail server requires communication between servers on port 25. Mail relays can use any port the mail server supports except for port 25.
iRedMail can function as a traditional mail server, which requires port 25, and as a mail relay to forward mail to a mail server.
Setup relayhost
Your solution is to configure iRedMail as a relay host forwarding mail on port 465 or 587 to a mail service such as Gmail, Office 365, SendGrid, etc. The email service will deliver your email.

Mezzanine contact form produces "upstream prematurely closed" error

My website uses Mezzanine 4.2.3 with Django-Oscar 1.5.2 and Django 1.10.8, running on Ubuntu 16.04 on Digitalocean. When I use the Mezzanine contact form on the demo page created with createdb, and from my own computer, it successfully sends out emails. But when I test it on my Digitalocean droplet running Ubuntu 16.04, I get 502 bad gateway.
The nginx error log records this error: *13 upstream prematurely closed connection while reading response header from upstream, client: [an IP I can't identify], server: [my website url], request: "POST /contact/ HTTP/1.1", upstream: "http://unix:/home/my-django-app/my-django-app.sock:/contact/", host: "[my website url]", referrer: "[my website url]/contact/". The number varies between *1, *7, and *13, but the text is the same.
I googled this and found various possible solutions:
Increasing the timeout for nginx proxy_pass. This involved adding proxy_connect_timeout 75s; and proxy_read_timeout 300s; to nginx config, and then adding --timeout 300 to gunicorn. This produced an actual timeout error: *21 upstream timed out (110: Connection timed out) while reading response header from upstream,
Uncommenting precedence ::ffff:0:0/96 100 in /etc/gai.conf..
Allowing port 587 in UFW. This shouldn't matter because if I'm using gmail, then this should be a port on Google's side of things, right? I'm only doing this because I see various solutions (most unresolved) talking about the need to unblock this port.
Making nginx listen on port 587: server {listen 80; listen 587; ... list 443 ssl; ...}.
With nginx listening on port 587, sudo netstat -tulnp | grep 587 shows:
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 12815/nginx -g daem
My email settings seem fine:
EMAIL_USE_TLS = True
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = "!#%%&&*%^#$^*%#gmail.com"
EMAIL_HOST_PASSWORD = "^*#^##$%&#$%%#$"
EMAIL_PORT = 587
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
I tried SSL with port 465 too. It worked with my local copy but not on the server. Same error message of 502.
I think "upstream" means gunicorn, so I set an error log for it, but all it recorded were status codes 200 and 302 when the page loaded. It didn't log anything when 502 happened.
I'm out of ideas. What am I missing?
Update 3 June 2018:
$ telnet smtp.gmail.com 587
Trying 108.177.96.109...
Trying 108.177.96.108...
Trying 2a00:1450:4013:c01::6c...
telnet: Unable to connect to remote host: Network is unreachable
Tried this with 465 and 25 too. Does this mean Digitalocean is blocking the connection? There's precedent.
Yes, Digitalocean blocks SMTP. Their reply to my email:
To assist with the restriction of SMTP services on your account, can
you please let us know the following:
Your name.
What business or individual you are going to send mail on behalf of as well as their website (if one exists).
What kind of mail you're going to be sending (password resets, newsletters, marketing mail, transactional mail such as order
confirmations).
If you're sending on behalf of a business or an individual that is not yourself, what is your relationship to that business or
individual.
Also, as we are a US based company, I'd like to make sure you
understand that we require all users of our network to follow both the
requirements of the CAN-SPAM (
https://www.ftc.gov/tips-advice/business-center/guidance/can-spam-act-compliance-guide-business
)act in regards to any non-transactional mail sent to any subscriber
anywhere in the world, as well as the CASL (
http://fightspam.gc.ca/eic/site/030.nsf/eng/home ) for any email you
send to any subscribers in Canada.
Additionally, there are additional restrictions to sending email to
users in Europe created by both the EU itself and its member
countries, and would recommend that you investigate and follow all
relevant guidelines for the countries of any European subscribers you
may have.
I answered them and they replied:
Thank you for the information you have provided.
We've reviewed the information and have removed the SMTP block from
your account.
Just to reiterate - we require our subscribers to follow the CAN-SPAM
act for all email, and the CASL for any email sent to a subscriber in
Canada.
If you do not, and we receive complaints of violations, we can revoke
access to SMTP at our discretion with no further warning.

Sending email with AWS SES via SMTP,error 421

So I have a domain purchased through SES which I have verified with SES.I have tested that sending/receiving works by signing into the email with the workmail web app.I am getting the following error when trying to send email with my spring app.
javax.mail.MessagingException: Could not connect to SMTP host: email-smtp.eu-west-1.amazonaws.com, port: 25, response: 421
Appconfig.Java
#Configuration
#PropertySource("app.properties")
#EnableTransactionManagement
public class AppConfig {
#Autowired
private Environment env;
#Bean
public JavaMailSender getJavaMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("email-smtp.eu-west-1.amazonaws.com");
mailSender.setPort(25);
mailSender.setUsername("noreply#mydomain.com");
mailSender.setPassword("mypassword");
Properties props = mailSender.getJavaMailProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.starttls.required", "true");
props.put("mail.debug", "true");
return mailSender;
}}
EmailServiceImpl.java
#Component
public class EmailServiceImpl {
#Autowired
public JavaMailSender emailSender;
public void sendSimpleMessage(String toAddress, String subject, String text)
{
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(toAddress);
message.setSubject(subject);
message.setText(text);
emailSender.send(message);
}
}
EmailServiceImpl is autowired into my web controller where I send an email after generating a password reset token
First of all,you have done everything right as said in the AWS docs.
You are right in using your smtp credentials as you are using their smtp interface to send mail,and not their aws sdk(if you use,aws sdk,you have to use acces key and password).
But,here comes some other issues which might help you resolve the issues which we have to do as it is not there in the docs.
You have to troubleshoot the error code sent by smtp.
Mostly,SMTP error code 421 shows up when the recipient mail server is very busy as it is receiving a lot of messages,so it temporarily defers your message by giving this error code or your recipient client have some problems.
You can study here.
https://sendgrid.com/blog/smtp-server-response-codes-explained/#:~:text=421%20%E2%80%93%20Your%20message%20was%20temporarily,locked%20or%20is%20not%20routable.
https://www.arclab.com/en/kb/email/smtp-response-codes-error-messages.html#:~:text=The%20SMTP%20error%20421%20is,see%20SMTP%20Error%20451%20below).
You can try sending the mail after sometime or you can try sending with different port.
My Incident:
I was using AWS SES for sending mail from my Springboot Application.
I was also using SMTP interface of AWS ses like you.
There are 3 ports which are listed on AWS management console to send mail.
But,when I was using Port 465,it was not working.
But,when I was using Port 25 or Port 587,it was working.
But,even then,It is always recommended to use 587 as it is recommended by IETF and is safest to use with TLS.
Using Port 465 is least recommended.You can study here but AWS supports it.There are many clients still supporting it but it is not widely in use.
As,I told you in my case it was failing.
You can study here about all the 3 ports and how port 465 functioning is different from port 25 and 587
But,you can solve the issue of port 465 by using smtps protocol with it.
Port-25,587(use smtp as protocol)
Port-465(use smtps as protocol,as in this case client has to initiate the tls encryption)
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-connect.html
You can get a guide from where to chose a port.
https://pepipost.com/blog/25-465-587-2525-choose-the-right-smtp-port/
You are using port 25. SES uses port 465 or 2465. Also remember to use SES SMTP credentials and not your IAM credentials (AccessKey).
Connecting to the Amazon SES SMTP Endpoint

Sending mail via amazon aws

I trying to send an email though amazon AWS
I have confirmed that I am able to send a email through postie like this:
postie.exe -host:email-smtp.eu-west-1.amazonaws.com -port:587 -ssl -tls -esmtp -to:barn.fleischer#gmail.com -from:barn.fleischer#gmail.com -s:"testmail" -msg:"This is a test" -user:XXXX -pass:YYYY
But when I try to send via System.Net.Mail
<mailSettings>
<smtp from="barn.fleischer#gmail.com">
<network host="email-smtp.eu-west-1.amazonaws.com"
port="587"
userName="XXXX"
password="YYYY"
enableSsl="true"/>
</smtp>
</mailSettings>
Unhandled Exception: System.Net.Mail.SmtpException: Failure sending mail.
---> System.Net.WebException: Unable to connect to the remote server
---> System.Net.Sockets.SocketException:
No connection could be made because the target machine actively refused it
Any suggestions?
Erik
Have you checked outgoing Windows firewall settings on that server? Make sure you have opened all standard ports eg 25 465 587 etc.

Applying encryption on email.yml / configuration.yml at Bitnami Redmine?

I'm a newbie on REDMINE(my version is 1.4.4)
I just got a question that is there any way that I can encrypt my email password on configuration.yml file which is to set up email configuration.
FYI, current setting is like below.
email_delivery:
delivery_method: :smtp
smtp_settings:
tls: true
address: smtp.gmail.com
port: 587
domain: smtp.gmail.com
authentication: :plain
user_name: "myEmailAddress#gmail.com"
password: "myEmailPassword" # I don't want to reveal my pw here :(
enable_starttls_auto: true
Thx in advance.
Yes you can but the only way I know to do it is to install and use Postfix as the relay and setup stunnel to handle the encrypted password exchange.
I had my system setup that way for a while but now I use Postfix without stunnel because Amazon SES service now supports starttls.
I had help from this site in my original setup:
http://quietmint.com/linux/postfix-relaying-mail-through-an-smtps-smarthost-on-port-465/
My latest setup I derived help from here:
http://blog.duoconsulting.com/2012/01/30/using-amazons-ses-with-postfix-as-a-smarthost-forwarder/