Unrecognized authentication type - Logstash - email

I am getting the below error while sending a mail Via Logstash email plugin ,
←[31mSomething happen while delivering an email {:exception=>#<Net::SMTPAuthenticationError: 504 5.7.4 Unrecognized authentication type
Below is my Logstash Confifuration for email plugin :
email {
from => "mymail#domain.com"
options => [ "smtpIporHost", "my ip",
"port", "25",
"userName", "mymail#domain.com",
"password", "password"
]
via => "smtp" # or pop or sendmail
subject => "Alert from Logstash"
body => "Here is the event line %{#message}"
htmlbody => "<h2></h2><br/><br/><h3>Full Event</h3><br/><br/><div align='center'>%{#message}</div>"
}
But when I use JAVA client (a java program) to send a mail, I am able to send a mail but cannot reciprocate with Logstash.
Am I missng any configuration ? to avoid the above error

I don't know what exactly email plugin version you are using in your logstash, but you should add:
authentication => "login"

Related

Wildfly Management API : What is URL for list Servergroups?

How to fetch server group details using Wildfly Management API
https://wildfly.prod.idntegrator.cosng.net/management?operation=attribute&name=server-group
{
"outcome" : "failed",
"failure-description" : "WFLYCTL0201: Unknown attribute 'servergroup'",
"rolled-back" : true
}
I am not able to find much information here:
https://docs.jboss.org/author/display/WFLY10/The%20HTTP%20management%20API.html
I tried from Jboss CLI but it has no attribute like servergroup but has /server-group=generic type notation not sure how to put in rest call
As far as I know there is no way to read just the server groups from the HTTP Management API. The best you could do is something like:
http://localhost:9990/management/?operation=resource
This would include an array of the server groups.
"server-group": {
"main-server-group": null,
"other-server-group": null
}
From CLI however you can use the read-children-names operation.
/:read-children-names(child-type=server-group)
Example output:
[domain#localhost:9990 /] /:read-children-names(child-type=server-group)
{
"outcome" => "success",
"result" => [
"main-server-group",
"other-server-group"
]
}

nodemailer: message queued but not sent

I am working with nodemailer to send email using custom SMTP server.
let transporter = nodemailer.createTransport({
host: 'my.smtp.host',
port: 587,
secure: false,
auth: {
user: 'user',
pass: 'password',
},
debug: true,
logger: true
})
let info = await transporter.sendMail({
from: from,
to: to,
subject: subject,
text: content,
html: content,
cc: cc,
bcc: bcc,
})
Following is the result of sendMail.
{
accepted: [
'to#to.com'
],
rejected: [],
envelopeTime: 39,
messageTime: 49,
messageSize: 1730,
response: '250 2.0.0 Ok: queued as 5513B432BE6',
envelope: {
from: 'from#from.com',
to: [
'to#to.com'
]
},
messageId: '<274421c8-1abd-4973-dd8e-f57285b46a70#from.com>'
}
And following is log message.
...
[2021-06-09 19:00:21] INFO [StdWZWNkAto] <1730 bytes encoded mime message (source size 1693 bytes)>
[2021-06-09 19:00:21] DEBUG [StdWZWNkAto] S: 250 2.0.0 Ok: queued as 5513B432BE6
[2021-06-09 19:00:21] DEBUG [StdWZWNkAto] Closing connection to the server using "end"
I already tested this SMTP server with other tools and it works correctly.
What's wrong?
Please help me.
Well, this means that nodemailer successfully send the email and now it is in the queue of your custom SMTP server, so you have to deal with it. For instance, sendmail allows to see the queue via mailq command and resend via sendmail -q (or sendmail -q -v for more information). If you need more details, you should provide info about your SMTP server.

Grails Send mail form Gmail Business Mail Exception : Authentication failed; nested exception is javax.mail.AuthenticationFailedException

I am trying to send an email using Google's Business email Account.
I am using Grails 3.2.7 and Grails's mail plugin ('org.grails.plugins:mail:2.0.0.RC6').
I am getting the following exception, even though I have set all the authentication credentials and I have set my account to allow less secure apps to access.
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException
Following are the settings for sending mail
mail {
host = 'smtp.gmail.com'
port = 587
username = "##### BUSINESS EMAIL from GMAIL###"
password = "PASSWORD"
props = ["mail.smtp.auth" : "true",
"mail.smtp.socketFactory.port" : "465",
"mail.smtp.socketFactory.class" : "javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback": "false"]
}
Anyone can help on why is it not sending email and failing on Authentication.
Please note that if I try to send the email using normal GMAIL account with same settings it is working fine.
Additional information
I am trying to send email to other domains from sender email being "BUSINESS EMAIL from GMAIL"
I have sent mail using Grails 3.1.8 and dependency
compile "org.grails.plugins:mail:2.0.0.RC2".
You can try it in grails 3.2.7
mail {
host = "smtp.gmail.com"
port = 465
username = "test#gmail.com"
password = "password"
ssl = "on"
props = ["mail.smtp.auth" : "true",
"mail.smtp.port" : "465",
"mail.smtp.socketFactory.port" : "465",
"mail.smtp.socketFactory.class" : "javax.net.ssl.SSLSocketFactory",
"mail.imap.ssl.checkserveridentity": "false",
"mail.imap.ssl.trust" : "*",
"mail.smtp.socketFactory.fallback" : "true"]
}

Mandrill Authentication error for meteorjs local application

I am trying to integrate Mandrill to send and receive emails in my application. I am doing the following from http://localhost:3000 -
Run following to add mandrill to meteor project -
meteor add wylio:mandrill
put the following in server startup -
Meteor.startup(function() {
return Meteor.Mandrill.config({
username: "mandrill-user-id#gmail.com",
key: "Valid API Key generated in Mandrill",
password: "Valid API Key generated in Mandrill",
});
});
Then call the following to send the email -
Meteor.Mandrill.send(
{ host: "smtp.mandrillapp.com"
, port: 587
, to: to//"customer#anydomain.com"
, from: from //"you#yourdomain.com"
, subject: "Mandrill knows Javascript!"
, body: "Hello from NodeJS!"
, authentication: "LOGIN"
, username: "username#gmail.com"//username
, password: "API Key from mandrill page"//password
}, function(err, result){
if(err){
console.log(err);
}
}
);
When I try sending the email, I get the following error -
Exception while invoking method 'sendQollMail' AuthError: Invalid login - 535 Authentication failed: Bad username / password
at Object.Future.wait (/Users/priyanka/.meteor/packages/meteor-tool/.1.0.40.1qwqep8++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:326:15)
at smtpSend (packages/email/email.js:91:1)
at Object.Email.send (packages/email/email.js:168:1)
at Object.Meteor.Mandrill.send (packages/wylio:mandrill/mandrill.js:12:1)
at Object.QollMailer.sendQollEmail (app/server/lib/QollMailer.js:58:21)
at [object Object].Meteor.methods.sendQollMail (app/server/lib/QollMailer.js:87:27)
at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1599:1)
at packages/ddp/livedata_server.js:648:1
at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
at packages/ddp/livedata_server.js:647:1
- - - - -
at SMTPClient._actionAUTHComplete (/Users/priyanka/.meteor/packages/email/.1.0.5.s8780m++os+web.browser+web.cordova/npm/node_modules/simplesmtp/lib/client.js:826:23)
at SMTPClient._onData (/Users/priyanka/.meteor/packages/email/.1.0.5.s8780m++os+web.browser+web.cordova/npm/node_modules/simplesmtp/lib/client.js:329:29)
at CleartextStream.emit (events.js:95:17)
at CleartextStream.<anonymous> (_stream_readable.js:764:14)
at CleartextStream.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:426:10)
at _stream_readable.js:419:7
at process._tickCallback (node.js:419:13)
Can you tell me what am I doing wrong here?
I was doing everything correct. Except that - sometimes back I had tried integrating with mailgun (or some other service). That required setting up following env variable -
process.env.MAIL_URL = 'smtp://username:password#host:port';
This was overriding the username/password in mandrill. Taking it out resolved the issue.

Notifying log errors via email using logstash

I'm working on sending a notification email using Logstash if an error occurs.
I'm using the email plugin coming as part of logstash : http://logstash.net/docs/1.4.2/outputs/email
On checking the documentation the To address seems to be the only required field and it didn't work when i specified it to my gmail id : pjesudhas#gmail.com
Is it required to have any other mail server running in my system for this to work, if so what do i have to do. Please let me know your thoughts.
email{
options => [ "smtpIporHost", "smtp.gmail.com",
"port", "587",
"userName", "pjesudhas#gmail.com",
"password", "mypassword"
]
from => "pjesudhas#gmail.com"
subject => "Error status"
to => "pjesudhas#gmail.com"
body => "Here is the event line that occured: %{#message}"
htmlbody => "<h2>%{matchName}</h2><br/><br/><h3>Full Event</h3><br/><br/><div align='center'>%{#message}</div>"
}
I also tried including my gmail id settings based on reading a tutorial but it didn't work either,please help me on this.
Gmail SMTP requires the to and from addresses to use a specific format: <example#example.org>
Try
email{
options => [ "smtpIporHost", "smtp.gmail.com",
"port", "587",
"userName", "pjesudhas#gmail.com",
"password", "mypassword"
]
from => "<pjesudhas#gmail.com>"
subject => "Error status"
to => "<pjesudhas#gmail.com>"
body => "Here is the event line that occured: %{#message}"
htmlbody => "<h2>%{matchName}</h2><br/><br/><h3>Full Event</h3><br/><br/><div align='center'>%{#message}</div>"
}