meteor: send email | AuthError: Invalid login - 535-5.7.8 - email

I've installed the email package and tried to sent a test mail, but it presents me with the following error: AuthError: Invalid login - 535-5.7.8 Username and Password not accepted
I'm sure the credentials are correct and the code is the same as: https://github.com/ideaq/meteor-email
/server/init.js
process.env.MAIL_URL="smtp://USERNAME%40gmail.com:PASSWORD#smtp.gmail.com:465/";
console.log(process.env.MAIL_URL);
Email.send({
from: "from#gmail.com",
to: "my-email#gmail.com",
subject: "Meteor Can Send Emails via Gmail",
text: "test"
});
also tried:
// configure email later for validation and sending messages
smtp = {
username: 'myusername#gmail.com',
password: 'my-pw',
server: 'smtp.gmail.com',
port: 465
};
process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' + encodeURIComponent(smtp.password) + '#' + encodeURIComponent(smtp.server) + ':' + smtp.port;
I can't seem to find any other information around this problem or how to followup on it. Who can give me a clue?

thx for the suggestions guys! I fixed it by actually turning ON 2-step verification, generate an app password and use THAT as login. Strange solution, but it worked!

Solution: It's the gmail security for less secure apps. Also a quick solution will be to turn off the access Allow less secure apps
Solution: Best way will be to work with 2-Step verification 2-Step Verification

In case you're using OAuth2 and you're facing the issue above, configuring my transporter as shown below resolved the error for me.
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
type: 'OAuth2',
user: process.env.MAIL_USER,
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
refreshToken: process.env.GOOGLE_CLIENT_REFRESH_TOKEN
}
});
If you're not sure how to generate the id, secret and token, follow the steps here https://medium.com/#pandeysoni/nodemailer-service-in-node-js-using-smtp-and-xoauth2-7c638a39a37e

Try port 25.
smtp = {
username: 'myusername#gmail.com',
password: 'my-pw',
server: 'smtp.gmail.com',
port:25
};

Related

Sending email by Nodemailer with GoDaddy hosted email, problem with sending on vercel.com

this is my config for nodemailer which is working on localhost without any problems.
export const transporter = nodemailer.createTransport({
pool: true,
service: 'Godaddy',
host: 'smtp.secureserver.net',
port: 587,
secure: false,
auth: {
user: email,
pass,
},
});
After deploy on vercel.com there is a problem while I'm sending an email. On screenshot you can see this error.
Propably the reason why I get this error is Serverless Function Execution Timeout.
Maybe somebody knwos how to fix it?
enter image description here
I tryed every configurations from here link

Trying to send email using smtp-relay.gmail.com and Nodemailer. Error ssl3_get_record:wrong version number

Trying to send email with G Suite smtp-relay using Nodemailer.
const transporter = nodemailer.createTransport({
host: "smtp-relay.gmail.com",
port: 587,
secure: true,
auth: {
user: "username#mydomain.com",
pass: "password"
}
});
const result = await transporter.sendMail({
from: `'"JOHN" <john#externaldomain.com>'`,
to: "hello#mydomain.com",
subject: "Hello",
text: "Hello world!",
});
This is what G Suite says about using TLS: Link1 Link2
This is what Nodemailer says: Link
CONTINUE
Basically G Suite tells me that I should use port 587 for TLS, and Nodemailer says I shouldn't.
Don't know if it has something to do with the ports, but this is the error I'm getting:
NOTE: I'm trying on port 587.
{ [Error: 13252:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
] code: 'ESOCKET', command: 'CONN' }
If I change to port 465, I get this error:
'535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials ',
responseCode: 535,
command: 'AUTH PLAIN' }
I know my user and pass are correct.
What am I doing wrong?
Basically G Suite tells me that I should use port 587 for TLS, and Nodemailer says I shouldn't.
Both talk about different things. The first one (G Suite) talks about SSL vs. TLS, i.e. compares various versions of the protocol. The second one (Nodemailer) talks about explicit vs. implicit TLS, i.e. explicitly upgrading a plain connection using the STARTTLS command (port 25 and 587) or establishing TLS directly after the TCP connect (port 465).
Thus, follow the recommendation from Nodemailer to set secure: false. If you want to enforce use of TLS, i.e. fail if STARTTLS is not supported by the mail server, then set requireTLS: true as documented.

Gitlab setup not sending email

I am trying to setup GitLab in windows azure. I followed this blog Setup GitLab in azure and it is working as charm. But I could not configure smtp mail sending through GitLab.
I have followed this settings SMTP Setup. Tried both Gmail and Zoho, with both ports 465 and 587
I am getting the following error
2016-09-21_09:44:28.55626 2016-09-21T09:44:28.556Z 13562 TID-vskyw WARN: {"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::DeliveryJob","queue":"mailers","args":[{"job_class":"ActionMailer::DeliveryJob","job_id":"6a954ac7-19d6-4b27-b28c-c511f25e6896","queue_name":"mailers","arguments":["DeviseMailer","confirmation_instructions","deliver_now",{"_aj_globalid":"gid://gitlab/User/1"},"tgShkQTx5e1sALoxkkGi",{"to":"<my email here>","_aj_symbol_keys":["to"]}],"locale":"en"}],"retry":true,"jid":"cbd7dc87ce4202265d1a6be7","created_at":1474450319.7324607,"enqueued_at":1474451065.2083879,"error_message":"end of file reached","error_class":"EOFError","failed_at":1474450320.9358478,"retry_count":5,"retried_at":1474451068.5555682}
2016-09-21_09:44:28.55639 2016-09-21T09:44:28.556Z 13562 TID-vskyw WARN: EOFError: end of file reached
I tried various combinations for SSL and TLS, but no luck yet!
I am using GitLab 8.11.7
Any help would be appreciated.
UPDATE:
I tried with GMail smtp and it works fine after allowing access to apps using this URL. This issue might be due to some Zoho's smtp policy
You should use the new smtp configurations
If you're installing from source and use SMTP to deliver mail, you will need to add the following line to config/initializers/smtp_settings.rb:
ActionMailer::Base.delivery_method = :smtp
As seen in https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.10-to-8.11.md#smtp-configuration
A configuration exemple for smtp_settings.rb is:
if Rails.env.production?
Rails.application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "email.server.com",
port: 465,
user_name: "smtp",
password: "123456",
domain: "gitlab.company.com",
authentication: :login,
enable_starttls_auto: true,
openssl_verify_mode: 'peer' # See ActionMailer documentation for other possible options
}
end
You can see the sample file doc for configuring SMTP at https://gitlab.com/gitlab-org/gitlab-ce/blob/8-12-stable/config/initializers/smtp_settings.rb.sample#L13?
You can see more configuration options here http://api.rubyonrails.org/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Configuration+options

GitLab 7.8 Email Notifications not working

I just installed GitLab 7.8 CE and all email notifications are not working. (Register/ForgotPassword/ResendConfirmation/ChangeEmail and many more)
After ~6 hours i'm just clueless how to solve this problem. Pls help!
It has something todo with "sendmail". But i have no clue how to switch it to "postfix" for example. The Server is CentOS7. I also searched all different kind of logs, but there is not a single response in any file. So no debugging either ;(
/gitlab/config/gitlab.yml
email_enabled: true
email_from: user#provider.com
/gitlab/config/environments/production.yml
config.action_mailer.delivery_method = :stmp
config.action_mailer.perform_deliveries = true
config.action_mailer.sendmail_settings = {
location: '/usr/sbin/sendmail',
arguments: '-i'
}
config.action_mailer.smtp_settings = {
address: 'provider.com',
port: 587,
domain: 'my-domain.com',
user_name: 'user#provider.com',
password: 'password',
authentication: 'plain',
enable_starttls_auto: true
}
delivery_method can either be :smtp or :sendmail (also, :test and :file, which are likely irrelevant for you). If you're using :smtp, then you don't need the sendmail_settings section, but you do need to properly configure the smtp_settings section.
In 7.8, I think smtp settings should go in config/initializers/smtp_settings.rb (see example file here).
See this link for all of the ActionMailer configuration options:
http://api.rubyonrails.org/classes/ActionMailer/Base.html

devise forgot password email not sending

Im trying to send a forgot password email. However the following error occurs -
Net::SMTPAuthenticationError in Devise::PasswordsController#create
535-5.7.8 Username and Password not accepted. Learn more at
I manage to see the sent email within the logs file but not within my actual inbox. Any ideas on how to fix this error?
Heres my development.rb code -
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "gmail.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: "myemail#gmail.com",
password: "mypassword"
}
Using: rails 4 and devise 3.2.3
Thanks
This error usually occurs when the associated email address is setup for 2-factor authentication. If you want to test with the same gmail account then generate an Application specific password. See details here.
If you have a another gmail account which does not require 2-factor authentication then try that one instead in your code.