Answer the question
In order to leave comments, you need to log in
Letters sent using JavaMailSender from amazon EC2 to google mail (aliases) do not reach
Hello!
I've never been involved in the web, but I had to work here. The problem is the following - we have a virtual machine (ubuntu) on amazon EC2 (so far without a domain name), a site (java + JSP) is spinning there, an apache server that proxies everything tomcat, a Postfix mail server. From Java I send mail, which is successfully sent and reaches the addressee, but letters do not arrive at a certain address (alias). Not even to a specific address, but to any alias with a specific domain name. People (to whom mail does not reach) have mail on google, just with their domain name (I can’t describe it in more detail, because I don’t understand this myself, but I think webmasters will understand what it is about).
I think the code is not needed, but just in case, I send mail like this:
MimeMessagePreparator preparator = new MimeMessagePreparator() {
@Override
public void prepare(MimeMessage mimeMessage) throws Exception {
MimeMessageHelper message = new MimeMessageHelper(mimeMessage,true,"UTF-8");
message.setFrom(emailFrom);
message.setTo(emailManager);
message.setSubject(emailToManagerSubject);
Map<String,Object> model = new HashMap<String, Object>();
// заполняю model
String text = VelocityEngineUtils.mergeTemplateIntoString(
velocityEngine,
"email_tpl.vm",
"utf-8",
model
);
message.setText(text, true);
}
};
try
{
this.mailSender.send(preparator);
}
catch (MailException ex)
{
logger.error("some text");
}
}
@Autowired
JavaMailSender mailSender;
@Autowired
VelocityEngine velocityEngine;
Answer the question
In order to leave comments, you need to log in
Have you looked at the responses of the Google mail daemons? They may consider your mail to be insecure or spam. Perhaps they do not condescend to answer. When sending my emails to similar Google aliases from a certain domain, there were also no responses at first, as far as I remember. Then one day it turned out:
<<< 552-5.7.0 This message was blocked because its content presents a potential
<<< 552-5.7.0 security issue. Please visit support.google.com/mail/bin/answe
<<< 552-5.7.0 r.py?answer=6590 to review our message content and attachment content
<<< 552 5.7.0 guidelines. i8si322258lam.42 - gsmtp
554 5.0.0 Service unavailable
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question