ERROR => ERROR => SMTP-AUTH: Authentication to smtp.gmail.com:587 failed - shell

I am trying to send an email using below command but i am getting below error:
Command executed:
/usr/bin/sendemail -v -f "mymail#gmail.com" -u "Re : Alerts Script" \
-t "$EMAILS" -s "smtp.gmail.com:587" -o tls=yes -xu "my#gmail.com" \
-xp "Password" -m "$Msg"
I tried with port 25, Still same error getting.
If i use 465 port getting below error
ERROR => smtp.gmail.com:465 returned a zero byte response to our query.
/usr/bin/sendemail -v -f "mymail#gmail.com" -u "Re : Alerts Script" \
-t "$EMAILS" -s "smtp.gmail.com:587" -o tls=yes -xu "my#gmail.com" \
-xp "Password" -m "$Msg"
Email should go for given email id's

I had faced the same issue and could resolve it. You can use the tls auto, 587 port command. Able to successfully send an email using Gmail SMTP.
/usr/bin/sendemail -f "mymail#gmail.com" -u "Re : Alerts Script" -t "$EMAILS" -s "smtp.gmail.com:587" -o tls=auto -xu "mymail#gmail.com" -xp "Password" -m "$Msg"
Also, you have to apply couple of settings in Gmail.
Enable IMAP
Allow less secure app
Review suspicious activity and mark 'That's me' to allow communication.

Also in windows you need to add sendEmail to your firewall.

To resolve this error for me in Windows (should work in any OS), I had to go into my Gmail account/Security/App Passwords on the web and generate a 16-digit password for App:"Mail" and Device:"Windows Computer" (you can create a custom device too) to give special access to the device where I was running SendEmail.
Per Google: "App passwords let you sign in to your Google Account from apps on devices that don't support 2-Step Verification."
Then I used that 16-digit password in SendEmail instead of my gmail password and it finally went through.
c:\sendemail\sendemail -o tls=yes -t recipient#email.*** -m Title HELLO -f [myaccount]#gmail.com -s smtp.gmail.com:587 -xu [myaccount]#gmail.com -xp **************** -l C:\sendemail\logfile.txt

Related

mosquitto_pub Error: '-l' mode not available threading support has not been compiled in

When trying to publish a message to a topic using the mosquitto_pub -l flag, I get the error:
Error: '-l' mode not available, threading support has not been compiled in.
How can I correct this?
For reference mosquitto_pub is version 1.5.3, running on libmosquitto 1.5.3., and the command I am trying to run is:
mosquitto_pub -h <hostname> -p <port> -t "<topic>" --cafile /usr/local/etc/openssl/cert.pem -d -P "$(cat mqtt-token-pub.txt)" -u <username> -l
Note: it works if I use -m "blah" instead of -l

Sending mail using shell command in Ruby

I'm trying to send an email using shell command in my ruby script.
I use command
%x{echo "sometext" | mail -s "Account report #{file_tmp}" -a /home/linux/reports/#{file} #{address[0]}}
and I get
Send options without primary recipient specified. Usage: mail
-eiIUdEFntBDNHRVv~ -T FILE -u USER -h hops -r address -s SUBJECT -a FILE -q FILE -f FILE -A ACCOUNT -b USERS -c USERS -S OPTION users sh:
line 2: send_report#gmail.com: command not found
Why an email address is taken as second line of command and how to fix it?
Try stripping newlines on the file variable:
%x{echo "sometext" | mail -s "Account report #{file_tmp}" -a /home/linux/reports/#{file.strip} #{address[0]}}

How to download file from server (sso and https)

It is possible to download a file from a server that use HTTPS + SSO (Single Sign ON) by means command line (of course using linux)?
The Single Sign On system run with shibbolet process
SOLVED!!
wget --save-cookies sso.cookie --keep-session-cookies --header="Referer: https://serverCheckPoint/" 'https://serverCheckPoint/Shibboleth.sso/Login?target=https://ServerCheckPoint/path_Of_The_File_To_Read'
curl -b sso.cookie -c 2sso.cookie -L -k -f -s -S https://IDP_SERVER/PATH_of_loginPAge --data "USER=yourUser&password=YOURPASSWORD" -o localfile.html
wget -v --load-cookies 2sso.cookie --save-cookies auth2.cookie --keep-session-cookies https://CheckPointServer/Path_of_data/DATA_to_DOWNLOAD
the file sso.cookie, 2sso.cookie, auth.cookie are used in order to store the session and the SAML token.
In case there are problem with certificates you should to disable the check for the TLS certificates

"The attachment [.../1.jpg] doesn't exist!" error when trying to send attachment using sendmail

I'm using the following command line in order to send an email with attachment from my Raspberry Pi (running raspbian):
sendEmail -f myemail#gmail.com -t someemail#gmail.com \
-u Mail Subject -m "Mail Message" \
-s smtp.gmail.com \
-o tls=yes \
-a "/home/pi/Desktop/Track/1.jpg" \
-xu myUserName -xp myPassword
and I get the following error:
Apr 07 15:19:52 raspberrypi sendEmail[19095]: ERROR => The attachment [/home/pi/Desktop/Track/1.jpg] doesn't exist!
(The image 1.jpg is, of course, does exist in this path).
Using the command without the -a works fine. I tried using a relative path but it didn't help. There is obviously something very basic I'm missing here but I could not find a good guide online on how it should be done.

smartd Mailing with sendmail

first of all i'm sorry for my english.
I'm trying to monitor the hard drives of a lot of Windows machines, and i've seen that can be done with smartd. I've read the man page and i've seen that is possible to sent a mail when an error occurs. I've done some test, searching info in google... but i can't make it work, the smartd daemon don't run the mail program.
I've tested with this in smartd.conf:
DEVICESCAN
/dev/hda -m UserName#SomeHost.com -M test -M exec c:\sendmail.cmd
and sendmail.cmd is a test script with a simple line:
"C:\sendEmail.exe" -f UserName#SomeHost.com -m "Hi There" -l c:\log.log -t UserName#SomeHost.com -s SomeHost.com -xu UserName#SomeHost.com -xp PassWord
The cmd script works perfect, but i don't know why smartd dont run that script...
Even I've tried with a hybrid:
/dev/hda -m UserName#SomeHost.com -M test -M exec "C:\sendEmail.exe" -f UserName#SomeHost.com -m "Hi There" -l c:\log.log -t UserName#SomeHost.com -s SomeHost.com -xu UserName#SomeHost.com -xp PassWord
but don't works too.
The Windows log shows how smartd daemon start and run "DEVICESCAN" command, but nothing about the other line.
I've tested with "smartctl -a /dev/hda" and shows the drive info.
What i'm doing wrong?
Thanks!!
Fixed... the problem is "DEVICESCAN". If you run that command all others are ignored. Even i've found an installer to install in a lot of PC's silently and configured.

Resources