Shopware 6 unable to sent Email - email

I installed and configured Shopware 6.
I configured Emails under Settings → System → Mailer (URL …/admin#/sw/settings/mailer/index)
Unfortunately Emails are still not sent (e.g. Order confirmation or Contact form)
In var/log/prod-2023-01-15.log is see the following line :
[2023-01-15T16:26:33.140153+00:00] app.ERROR: Could not send mail: Failed sending mail to following recipients: {{ recipients }} with Error: Expected response code „250“ but got c ode „550“, with message „550 5.7.1 Sender mismatch“. Error Code:0 Template data: {„recipients“:{„thorsten.niehues#posteo.net“:"thorsten.niehues#posteo.net"},„senderName“:„{{ sale sChannel.name }}“,„salesChannelId“:„c6aa23ebbf0b48d490237ff19bdb47b3“,„templateId“:„5e09e2c5fdb248da8329b09b16d8b6ef“,„customFields“:null,„contentHtml“:„\n
\n The following Message was sent to you via the contact form.\n \n Contact name: {{ contactFormData.firstName }} {{ contactFormData.lastName }}\n \n Contact email address: {{ contactFormData.email }}\n \n Phone: {{ contactFormData.phone }}\n \n Subject: {{ contactFormData.subject }}\n \n Message:\n {{ contactFormData.comment|nl2br }}\n \n\n“, „contentPlain“:„The following Message was sent to you via the contact form.\n\nContact name: {{ contactFormData.firstName }} {{ contactFormData.lastName }}\nContact email address: {{ contactFormData.email }}\nPhone: {{ contactFormData.phone }}\n\nSubject: {{ contactFormData.subject }}\n\nMessage:\n{{ contactFormData.comment }}\n“,„subject“:„Contact form re ceived - {{ salesChannel.name }}“,„mediaIds“:}
I tried to remove all variables form the template to make sure it is not a template issue … but then I still get the error :
[2023-01-15T16:32:14.098476+00:00] app.ERROR: Could not send mail: Failed sending mail to following recipients: {{ recipients }} with Error: Expected response code „250“ but got c ode „550“, with message „550 5.7.1 Sender mismatch“. Error Code:0 Template data: {„recipients“:{„thorsten.niehues#posteo.net“:"thorsten.niehues#posteo.net"},„senderName“:„PlsUseV ariable“,„salesChannelId“:„c6aa23ebbf0b48d490237ff19bdb47b3“,„templateId“:„5e09e2c5fdb248da8329b09b16d8b6ef“,„customFields“:null,„contentHtml“:„Test Contact Form / Email (HTML)“, „contentPlain“:„Test Contact Form / Email (Plain)“,„subject“:„Contact Request“,„mediaIds“:}

550 5.7.1 Sender mismatch is an error returned by the mail server and means that the mail was rejected. This could be because the mail data is either incomplete or violates some security settings of the mail server.
Since it specifically mentions the sender, have you made sure that the mail of the sender is set? By default it should use the address set in the settings of the administration. Have a look at what is set for the Shop owners email address at Settings > Basic information in the administration and verify that it is a valid email address. You can also read the value of the setting quickly by using the CLI:
bin/console system:config:get core.basicInformation.email
Likewise you can also write the setting from the CLI:
bin/console system:config:set core.basicInformation.email doNotReply#localhost.com
Note: You can also set a reply-to address in the mailer settings core.mailerSettings.senderAddress but the address set in the basic information has priority and will be used instead unless it is empty. See the corresponding code here.

Related

KeyCloak fails to send email using SMTP with status 500

I have Keycloak running in a Kubernetes cluster. Authentication works but I need to set up e-mail to be able to send e-mails for verification and password reset.
I have SendGrid set up as an SMTP Relay. These settings (host, port and api key) work when I send mail using the SendGrid java client. However, when pressing Test connection in KeyCloak I get:
[Error] Failed to load resource: the server responded with a status of 500 ()
[Debug] Remove message (services.js, line 14)
[Debug] Added message (services.js, line 15)
[Error] Can't find variable: error
https://<domain>/auth/resources/ong8v/admin/keycloak/js/controllers/realm.js:76 – "Possibly unhandled rejection: {}"
[Debug] Remove message (services.js, line 14)
There isn't much to go on here. I have an e-mail address set up for the currently logged in user. I've also tried resetting the password in case the Test connection functionality was broken but that didn't work either.
The Realm Settings settings user for email are as such:
host: smtp.sendgrid.net
port: 587
from: test#<domain>
Enable StartTLS: true
Username: "apikey"
Password: <api key>
Any idea what can be wrong? Or how to find out? For instance, maybe I can get a more meaningful error message somehow.
Edit:
I got the server logs.
Failed to send email: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.sendgrid.net, 587; timeout 10000;
nested exception is: java.net.SocketTimeoutException: connect timed out
Edit 2:
I've tried sending mail using Telnet using the exact same settings and that works. So apparently it's something with Keycloak or its underlying Java libraries that's causing issues sending e-mail.
Turns out that Keycloak works and that emails were blocked by the hosting provider.

Sender address rejected using Ansible mail

I get the following error when I try to send an email from an Ansible playbook using mail.
SMTPRecipientsRefused: {'Jack.Jones#nsd.com': (504, '5.5.2 <root>: Sender address rejected: need fully-qualified address')}
The playbook contains
- name: Send the processing resumed email
mail:
host: smtphost.nsd.com
port: 25
to: Jack.Jones#nsd.com
subject: "Processing of {{ event_name }} events has been resumed"
body: "Processing of {{ event_name }} events has been automatically resumed by the CICD pipeline."
I've tried all sorts of variations for the to: address and nothing seems to fix it.
So the error message is a bit misleading the problem is actually caused by the absence of the from: field not the value in the to: field.
In the absence of the from: field a default value of root is used. As it does not have the #nsd.com extension on it and is thus malformed from the point of view of the email server.
After adding the from: field to the playbook it works properly.
- name: Send the processing resumed email
mail:
host: smtphost.nsd.com
port: 25
to: Jack.Jones#nsd.com
from: CICD.Resume.Service#nsd.com
subject: "Processing of {{ event_name }} events has been resumed"
body: "Processing of {{ event_name }} events has been automatically resumed by the CICD pipeline."

Jhipster - Configuring Email with Zoho - Error 553 Relaying disallowed

I am new to Jhipster and trying to configure zoho and I am getting errors.
My setting in /myjhipsterapplicationname/src/main/resources/config/application-dev.yml
mail:
host: smtp.zoho.com
port: 587
username: ****#myCustomDomainOnZoho.com
password: ****** // My password for the above email
protocol: smtp
tls: true
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.zoho.com
Errors, I am receiving
2017-03-02 21:15:13.421 WARN 6192 --- [ints-Executor-2] com.nectotech.com.service.MailService : E-mail could not be sent to user 'asif#nectotech.com'
org.springframework.mail.MailSendException: Failed to close server connection after message failures; nested exception is javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Connection closed by remote host. Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 553 Relaying disallowed as breakpoints#localhost
I tried the following and it worked.
Go to /myjhipsterapplicationname/src/main/resources/config/application-dev.yml
Search for
mail: # specific JHipster mail property, for standard properties see MailProperties
from:
Replace the value of property from: with your SMTP outgoing email address

FOSUserBundle not sending registration email

I have found a few topics related to the same issues, but the solution for them was a miss-configuration of the smtp settings.
I am using symfony 3.0 and latest FOSUserBundle. My config settings are:
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
resetting:
email:
template: email/password_resetting.email.twig
registration:
form:
type: AppBundle\Form\RegistrationType
confirmation:
enabled: true
from_email:
address: registration#site.com
sender_name: 'Our Team'
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
port: "%mailer_port%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
I am able to send other emails from the same project, using the same swiftmailer settings.
I have checked the web developer tool and the email is prepared for sending
Web profiler - email area
The registration email is not received in the inbox or spam folders.
Could you let me know if I have missed anything in the configuration files that prevents the registration email from being sent?
Thanks,
Lucia
I found a solution for my problem. The registration email address had to be the same as the one used for the swiftmailer username settings. Having it set to a different email address did not work for me.

How to send email with Jenkins and an parameter address?

I'm using Jenkins and I would like to send an email after finished job. The problem I have is that I want to use the username defined before into a parameter in the configuration. I try to use then ${username} but i doesn't work. This is the error I get:
Sending e-mails to: ${username}#email.es
ERROR: Invalid Addresses
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 <${username}#email.es>... User unknown
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1835)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1098)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at hudson.tasks.MailSender.run(MailSender.java:126)
at hudson.tasks.MailSender.execute(MailSender.java:101)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.cleanUp(MavenModuleSetBuild.java:1064)
at hudson.model.Run.execute(Run.java:1764)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 <${username}#email.es>... User unknown
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1686)
... 10 more
It is not taking the value of the parameter. Is thera any plugin or way to do this ?
Thanks for your help.
instead of ${username} - use $username
Ex: $username#$domain.com
Here, username and domain are two parameters for build
(defined by selecting checkbox-This build is parameterized)
Configure Jenkins System for Email Notifications
To do this:
"Jenkins Dashboard -> Manage Jenkins -> Configure System"
At the bottom of the page- find : Email Notification
Then give email notification details
I have configured like this:
SMTP server : smtp.gmail.com
Default user e-mail suffix : #gmail.com
select checkbox USE smtp authentication
give: username (without #gmail.com) -eg: enter mike for mike#gmail.com
give your password
Select checkbox Use SSL
SMTP port : 465
try your email settings by sending a test mail
If your able to send it successfuly. its done
/* In the Build - The Build is Parameterized */
1st parameter
Name : username
Default Value : mike
2nd Parameter
Name: domain
Default Value: gmail
//Post-Build Actions - Email Notification
(able to see this only when you have Mailer plugin installed)
Recipients : $username#$domain.com
This should work ..
I 'found' the solution. With a maven project, it doesn' work with the simply Email notification inside the Build properties. I must use a plugin 'Ext-mail plugin' to do it. Thanks for all.