discourse can't send email - amazon-web-services

i installed a discourse on AWS bitnami edu3d.co. I did the following things but still can't send the login verification email.
config the discourse by this instruction https://docs.bitnami.com/bch/apps/discourse/configuration/configure-smtp/
in AWS, request email sending limits
in AWS, verify my email identity,
in AWS, send test email (it is correct)
create my credential
checked spam boxes (no email)
Thank you!

The problem is solved. I guess problem is that I set the username and password wrongly.
smtp_address = ''
smtp_port = 587
smtp_domain = 'edu3d.co'
smtp_user_name = ''
smtp_password = ''
smtp_enable_start_tls = true
smtp_authentication = login
If you have problem in setting smtp for the discourse installed on AWS EC2 bitnami. You can do the following checks.
1) check whether your VM instance can connect the smtp server (test if smtp_address and smtp_port are correct)
I found 25 is not responding and 465 sometimes broke too, 587 works well.
2) check whether your username and password set correctly.
AWS provides this instruction https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-client-command-line.html
How I find the problem
I really can't figure out why the smtp setting is 'correct' but i just can't receive the email. So I changed to gmail, the setting is a bit easier than AWS SES. After change, I received the email immediately but it says the login method is not secure so Google blocked it. This proves the smtp setting is working. And according to previous test, my VM instance can connect to the smtp server. So there should have something wrong in the smtp setting.
I go to AWS SES, intending to check the my credential. But I can only create a new one. So I did, then I found I misunderstood the username and password. After change, the email is working. Great!
The following instruction is very helpful!
https://docs.bitnami.com/bch/apps/discourse/configuration/configure-smtp/

Related

Sending email with Django using Gmail not working

I'm new to Django and I want to send the email through my Django server using my Gmail account but unfortunately, I'm getting an error while sending emails even though I've put all credentials correctly there is one thing more in my Gmail account which is "less secure apps" that has to be enabled but this feature is no longer available in Gmail so now how can I send the emails in Django?
error while sending the email
b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials f14-20020a05600c4e8e00b0039c5642e430sm4688852wmq.20 - gsmtp'
Since May 30 2022 the less secure apps feature has been disabled. Now, to let 3rd party apps access gmail you must generate an App password and to generate an app password you must first enable 2-factor authentication for your account:
https://myaccount.google.com/apppasswords
Once you have the app password you can simply replace your host account password with the app password:
EMAIL_HOST_PASSWORD = '<app_password>'
You can find the complete email integration process wonderfully explained here: https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog/12-Password-Reset/django_project
im looking forward for an answer too, as i am experiencing the same problem.
In the meantime, i had to change the email provider to another company, for me it worked with mailjet, they have a free plan and no card info needed, hope this helps you!

Use flask-mail with Amazon SES

I want to use Flask mail with Amazon SES. I know it's possible to use the boto library instead, but in the long term, I want to use different smtps. (this is thus a different question than How to adapt flask-mail to support two SMTP accounts)
So, I registered in Amazon SES, and got a client id and secret id. I have also registered the mail adress with which I want to send emails in my application. Now, my question is, how should I configure my application (see below variables)?
MAIL_USERNAME = config.get('mail_service', 'USER')
MAIL_PASSWORD = config.get('mail_service', 'PASSWD')
MAIL_SERVER = config.get('mail_service', 'MAIL_SERVER')
MAIL_PORT = 587
For MAIL_SERVER, I already found it. However, for username and password, I'm not sure how to provide both mail_adress (example#gmail.com), client_id (SES) And both password (mail password + secret_id from SES).
Any ideas?
Thanks a lot

Email send using app password - Username and Password not accepted?

I can't figure out why I can't send email in Django.
I've enabled 2-step verification and generated App Password for this connection.
But Gmail smtp returns:
SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials q29sm16257362qtc.10 - gsmtp')
I thought that using App Password will not cause such errors.
EDIT:
The email uses a custom domain but I guess this is not a problem. I think that smtp.gmail.com should work.
I haven't allowed less secured apps since I think it is not needed with App Password.
I had the same problem with two-factor authentication and allowed less secured apps. It is necessary to use App password ! there is still one last feature to activate: https://accounts.google.com/DisplayUnlockCaptcha
If you have a Gsuite domain click on this link : https://admin.google.com/ac/security/lsa and "Allow users to manage their access to less secure applications"

Email address is not verified (AWS SES)

I want to use Amazon's Simple Email Service to send emails.
I verified my domain as well as the email address I want to send from.
For both it says verified.
Now when I use the Send Test Email from the AWS Console to send a test email to myemail#outlook.com, I only get the error message:
Email address is not verified. The following identities failed the
check in region EU-WEST-1: myemail#outlook.com (Request ID:
9fb78de1-2673-11e6-bbbc-5f819fabe4f4)
Now it strikes me because it says myemail#outlook.com was not verified but I tried to send from admin#mydomain.example. The Send Test Email Dialog even forces you to use an email which already is registered.
How can this issue be resolved? Did I miss anything?
When your SES account is in "sandbox" mode, you can:
Only send from verified domains and email addressed, and
Only send to verified domains and email addresses
In order to send to anyone else, you must move your account out of sandbox mode by contacting AWS support and requesting it:
https://docs.aws.amazon.com/console/ses/sandbox
In my case I needed to verify the email again in the region where it failed. You can try to change your region in the top right then you have click again "Verify a New Email Address"
If the email is already verified and you're out of the SES Sandbox, check that you've the correct AWS region for the SMTP server. I was trying to connect to email-smtp.eu-west-1.amazonaws.com when my SMTP credential was for the email-smtp.us-east-1.amazonaws.com server.
#Matt Houser has already answered the questions but I am adding a screenshot from June, 2020 that explains what he said.
Make sure
You add your email to ses and get verified.
You enable the Production mode for your account.
Make sure
-You have submitted your case request to support customer and explain in what purposes confirm it for to 24 maybe they will ask you about some additional information about your application
I had this issue. I verified domain and email, even the DKIM settings was verified.
But still getting this message :
Email address is not verified. The following identities failed the check in region {aws_region}: {email}
I added SourceArn as parameter for sendEmail than get this message :
User `arn:aws:iam::{account_id}:user/{username}' is not authorized to perform `ses:SendEmail' on resource `arn:aws:ses:{aws_region:{account_id}:identity/{email}'
After 2 days I found out the I was using wrong IAM user !
Be aware the Verified Identities are actually case sensitive. I was wondering why I got such error, even though my email was verified and out of SandBox.
Problem
Confusion comes from the fact that your e-mail address shows as "Verified" in AWS SES -> Verified identities and still not working.
In fact, there are two verification:
DKIM one (which makes the field tick green and verified)
E-mail address verification
That means you must use the e-mail address which you have access to (mailbox) in order to click in the verification link.
Without clicking the link in the e-mail, your identity may be verified but you'll still see the error everywhere.
Simple solution using AWS WorkMail
I am using AWS WorkMail but I've created a new Group instead of another WorkMail account, then added my personal account to it, received a verification e-mail and managed to get: "noreply#..." working.
In my case, I wanted to email to the same verify email.
So, I verified my email by DKIM as #Greg Wozniak mentioned. I saw the field tick green and verified:
But I was still seeing:
Email address is not verified. The following identities failed the check in region...
The solution in my case was to add this function in the code:
def verify_email_identity():
ses_client = boto3.client("ses", region_name="us-east-1")
response = ses_client.verify_email_identity(
# Email address that will receive the email
# In my case the same email address
# that was verified on Amazon SES
EmailAddress="receipientemail#gmail.com"
)
print(response)
Taken from this webside
So, I received a new email to verify the recipient email address. After verify the recipient email address by clicking in the link sent by Amazon SES. I was able to send the email with this code:
client = boto3.client('ses',region_name="us-east-1")
# Try to send the email.
try:
#Provide the contents of the email.
response = client.send_email(
Destination={
'ToAddresses': [
receipientemail#gmail.com,
],
},
Message={
'Body': {
'Html': {
'Charset': "UTF-8",
'Data': "Test",
},
},
'Subject': {
'Charset': "UTF-8",
'Data': "Test",
},
},
Source=receipientemail#gmail.com,
)
# Display an error if something goes wrong.
except ClientError as e:
print(e.response['Error']['Message'])
else:
print("Email sent! Message ID:"),
print(response['MessageId'])
I had verified an email address, and then a few days later my domain. When the domain was fully verified (inc DKIM) I was still getting the 'Email address is not verified' error when trying to send emails to email addresses within my domain, that weren't my specific verified address.
I deleted my verified email address, and re-verified it, and it worked immediately. I could then send domain wide emails, whereas before - I could only send to and from the email I had previously verified.
I was having the same issue a couple minutes ago, although this time I'm working with the SDK in PHP.
I had to double check the SesClient instantiation code.
$SesClient = new SesClient([
'profile' => 'default',
'version' => '2010-12-01',
'region' => 'us-west-2',
]);
I discovered that the region in the instantiation code is us-west-2.
I went back to my console and discovered that SES account was sandboxed in us-east-2 (Ohio).
I implemented the change in the instantiation code like so
$SesClient = new SesClient([
'profile' => 'default',
'version' => '2010-12-01',
'region' => 'us-east-2',
]);
It's working now.
I had this issue and none of the above worked for me. My issue related specifically to sending via python using boro3. I eventually figured out that the system I was working on had a different set of aws credentials stored in the windows system than it did on the Linux subsystem on the same windows machine. The solution was to set both sets of aws credentials to match the appropriate aws account. I add this here just in case anyone has the same issue and, like me, couldn't find an answer.
For me the issue was that I was mismatching cases.
The verified email and the email sent have to match exactly.
test#gmail.com vs Test#gmail.com

AWS SES Verified mail but still getting an error 554

I am having issues with sending email from a verified email.
(asking it here, as for some reason I can't ask in AWS forum)
Setup:
The email XXX.mydomain.com is verified.
domain mydomain.com is verified (in domain list).
I am testing through 'Send email Test' in AWS.
The sender (from) is the verified email.
When I send to +DDVVF#mydomain.com+, it's fine (email is sent).
When I send to a different email (my-client#other-domain.com), I get an error message, containing:
Email address is not verified. (Request ID:
73ee3c33-ef6b-11e5-a37e-e5f5988f938c)
Should I also verify the TO emails I want to send?
It doesn't seem scalable, as I don't want to verify each TO separately.
Any ideas?
Thanks,
It seems you are still in the sandbox , you need to log in request with AWS to move you to Production.
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html