how to receive mail commandline? - email

Can anybody suggest me a way to receive mail from commandline and save it to a file. i have tried some tool but those were of no use. i tried getmail and popclient. but every time i get an error. may be my syntax is wrong.
in getmail i tried this command
getmail -u myemail#gmail.com -pw password -s imap.gmail.com -port 110
and got error of winsock.dll
i have also tried it with port 993 and in this case it gave error of possible time out
and in popclient i also used this type of settings in config.xml but i got the same error of server not responding.can anybody figure out what's the problem?

The port number is wrong for gmail, and you need to use the POP access feature of gmail and the POP email server to connect to (not via imap).
Gmail uses a secure port and also SSL security. Enable the POP retrieval/access in Gmail configuration and read the Gmail help on how to access via POP (for any client) - it will list the port number and server name and security encryption.

Related

How to send emails through an External SMTP Service on Digital Ocean?

I would like to send emails through an External SMTP Service (Yandex) with Sendmail on Ubuntu 18.04.3. I use Digital Ocean.
I set everything up: External SMTP Service, Sendmail, hostname. I added the MX record to my DNS.
~hostname
childrengo.org (my domain)
~host childrengo.org
childrengo.org has address <IP>
childrengo.org mail is handled by 10 mx.yandex.net.
I made a file with my login and password - /etc/mail/authinfo/yandex-auth :
AuthInfo:smtp.yandex.ru "U:<My login>" "I:<email>" "P:<password>" "M:<login>"
AuthInfo:smtp.yandex.ru:587 "U:<My login>" "I:<email>" "P:<password>" "M:<login>"
And than:
makemap hash /etc/mail/authinfo/yandex-auth < /etc/mail/authinfo/yandex-auth
I set up Sendmail to send emails through an External SMTP Service (Yandex).
But I have got an error in my syslog:
: STARTTLS=client, relay=smtp.yandex.ru., version=TLSv1.3, verify=FAIL, cipher=TLS_AES_256_GCM_SHA384, bits=256/256
: 05BInLgB007204: AUTH=client, available mechanisms do not fulfill requirements
: AUTH=client, relay=smtp.yandex.ru., temporary failure, connection abort
: 05BInLgB007204: to=<EMAIL>, ctladdr=<root#childrengo.org> (0/0), delay=00:11:24, xdelay=00:00:00, mailer=relay, pri=300379, relay=smtp.yandex.ru. [<IP>], dsn=4.0.0, stat=Deferred: Temporary AUTH failure
I checked this https://www.digitalocean.com/community/tutorials/how-to-send-email-through-an-external-smtp-service-with-sendmail-on-freebsd-10-1 and this https://www.digitalocean.com/community/questions/ubuntu-14-04-lamp-installed-sendmail-fatal-error-when-i-sent-first-message It did not help.
I installed cyrus-sasl*
I have the TXT records for DMARC1, spf1 and DKIM for my domain.
I have tried different users to send email. And I checked the password. I also checked the user exists.
I also don't see these errors in my mail.log and in mail.err
Do you have any idea how to fix it? Or may be how to debug it?
I installed SASL again:
sudo apt-get install sasl2-bin
service saslauthd restart
service sendmail restart
After that I had a problem with authorisation. It failed even if I was sure the login and password combination is right.
In the end I find out a tricky thing. There is an application password which you can user to let some application to login to your mail from the yandex mail provider. But if you create a mail for your domain on yandex it cannot login through smtp with a password nor with an application password. It does not know which combination is ok and just return an error.
So I removed an application password and everything works fine now. I hope this small trick also would useful for somebody.
may be you need to change droplet name to domain name.

How to configure SSL for Meteor email sendMail?

My meteor app is running behind a firewall and my smtp settings for gmail are not getting through:
e.g. process.env.MAIL_URL = "smtp://user#gmail.com:password#smtp.googlemail.com:465"
I get 'Exception while invoking method 'sendEmail' Error: connect EHOSTUNREACH'
I gather I need to set SSL but don't know where/how to do this.
Any ideas?
many thanks
Max
You're doing it correctly but the user:password part can't have an '#' symbol in it or the system gets confused.
This should do what you want:
process.env.MAIL_URL = "smtp://user%40gmail.com:password#smtp.googlemail.com:465"
Thanks -
FWIW, I wanted to use meteor to access a local mail server on my linux box. (My VPN won't let me access mailgun or any other remote mail server.)
This turned out to be pretty simple: process.env.MAIL_URL = "smtp://localhost:25"
Note, this is on a local mail server without authentication.
take care
Max

Send mail via CMD console

Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed.
i tried this article http://jpsoft.com/help/index.htm?sendmail.htm
sendmail "bob#bob.com bcc:joe#joe.com" Test Hello!
the error is :
'sendmail' is not recognized as an internal or external command operable program or batch file
and
this article : http://www.brighthub.com/office/collaboration/articles/21840.aspx#imgn_1
c:\>"c:\program files\microsoft office\office12\outlook.exe" /c ipm.note /m someone#gmail.com /a "c:\logs\logfile.txt"
the error is :
the process can not access the file because it is being used by another proccess
but it didnt worked. i dont know where is the problem or what is the problem.
thanks for your advice.
Scenario:
Your domain: mydomain.com
Domain you wish to send to: theirdomain.com
1. Determine the mail server you're sending to.
Open a CMD prompt
Type
NSLOOKUP
set q=mx
theirdomain.com
Response:
Non-authoritative answer:
theirdomain.com MX preference = 50, mail exchanger = mail.theirdomain.com
Nslookup_big
EDIT
Be sure to type exit to terminate NSLOOKUP.
2. Connect to their mail server
SMTP communicates over port 25. We will now try to use TELNET to connect to their mail server "mail.theirdomain.com"
Open a CMD prompt
TELNET MAIL.THEIRDOMAIN.COM 25
You should see something like this as a response:
220 mx.google.com ESMTP 6si6253627yxg.6
Be aware that different servers will come up with different greetings but you should get SOMETHING. If nothing comes up at this point there are 2 possible problems. Port 25 is being blocked at your firewall, or their server is not responding. Try a different domain, if that works then it's not you.
3. Send an Email
Now, use simple SMTP commands to send a test email. This is very important, you CANNOT use the backspace key, it will work onscreen but not be interpreted correctly. You have to type these commands perfectly.
ehlo mydomain.com
mail from:<martin9700#mydomain.com>
rcpt to:<recipient#theirdomain.com>
data
This is a test, please do not respond
.
quit
So, what does that all mean?
EHLO - introduce yourself to the mail server HELO can also be used but EHLO tells the server to use the extended command set (not that we're using that).
MAIL FROM - who's sending the email. Make sure to place this is the greater than/less than brackets as many email servers will require this (Postini).
RCPT TO - who you're sending it to. Again you need to use the brackets. See Step #4 on how to test relaying mail!
DATA - tells the SMTP server that what follows is the body of your email. Make sure to hit "Enter" at the end.
. - the period alone on the line tells the SMTP server you're all done with the data portion and it's clear to send the email.
quit - exits the TELNET session.
4. Test SMTP relay
Testing SMTP relay is very easy, and simply requires a small change to the above commands. See below:
ehlo mydomain.com
mail from:<martin9700#mydomain.com>
rcpt to:<recipient#someotherdomain.com>
data
This is a test, please do not respond
.
quit
See the difference? On the RCPT TO line, we're sending to a domain that is not controlled by the SMTP server we're sending to. You will get an immediate error is SMTP relay is turned off. If you're able to continue and send an email, then relay is allowed by that server.
Unless you want to talk to an SMTP server directly via telnet you'd use commandline mailers like blat:
blat -to you#example.com -f me#example.net -s "mail subject" ^
-server smtp.example.net -body "message text"
or bmail:
bmail -s smtp.example.net -t you#example.com -f me#example.net -h ^
-a "mail subject" -b "message text"
You could also write your own mailer in VBScript or PowerShell.
From Linux you can use 'swaks' which is available as an official packages on many distros including Debian/Ubuntu and Redhat/CentOS on EPEL:
swaks -f you#example.net -t someone#example.com \
--server mail.example.com
A couple more command-line mailer programs:
mailsend
Mail Alert Simple Mailer
Both support SSL too.

Jenkins SMTP connection refused. What am I missing?

I've got Jenkins ver 1.524 installed on a Windows 7 box and I'm trying to configure email but the "Test configuration" is reporting errors. Jenkins is running as a service under my own domain account.
My settings are as follows:
SMTP server: smtp.corpdomain.com
Default user email suffix: #corpdomain.com
Not using authentication
Not using SSL
SMTP port: 25
Reply-To Address: tools#corpdomain.com
Charset: UTF-8
When I test the configuration, I usually get the following exception:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.amazon.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
Yet every once in a while I receive the following instead:
com.sun.mail.smtp.SMTPSendFailedException: 553 5.1.8 <nobody#nowhere>... Domain of sender address nobody#nowhere does not exist
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 553 5.1.8 <nobody#nowhere>... Domain of sender address nobody#nowhere does not exist
However, I am able to send mail from the command line without errors via both python script and java (using javax.mail) without authentication, and I'm able to telnet to the SMTP server on port 25, so I don't see how it could be a firewall issue.
One other note that may be related: When I try to install a plug-in via the Jenkins web interface, I receive a 403 response for the URL "http://updates.jenkins-ci.org/update-center.json?uctest". However, I'm able to connect to that URL from a browser on the same machine.
Could this be a Tomcat configuration issue? I'm not familiar with Tomcat so I'm not sure where to even start looking. Maybe a Jenkins configuration that I've missed? Any other ideas?
Thanks in advance!
FWIW The nobody#nowhere address is the default address Jenkins comes with for the system admin email address (which is used as the from address when sending emails)
you can change it at
Manage Jenkins > Configure System > Jenkins Location
first, use port 465
second, get your email verified in AWS SES, and change your default sending email from here:
Jenkins -> Configure System -> Jenkins Location -> System Admin e-mail address
Still looks to me like your firewall is blocking Jenkins' service from accessing those ports -
especially as the connection times-out, which is typical for such cases.
Suggest you try to disable the firewall completely and see if there is any change.
Cheers
To check for conectivity problems from Jenkins, I would go to the Script Console at Manage Jenkins -> Script Console, and there, try to connect to the port you want to test (25 in your case), with a Groovy script like:
s = new Socket()
s.setSoTimeout(200)
s.connect(new InetSocketAddress("smtp.corpdomain.com", 25), 200)
s.close()
If you don't receive any kind of IOError, then there is no problem with the conectivity.
Note: I could have used simply new Socket("smtp.corpdomain.com", 25) but it will try forever to connect if the Firewall ignores your attempts.
For the SMTPSendFailedException you eventually receive, as #paul-henry mention:
The nobody#nowhere address is the default address Jenkins comes with for the system admin email address (which is used as the from address when sending emails)
you can change it at
Manage Jenkins > Configure System > Jenkins Location
Resources:
Networking with Groovy
Add a timeout when creating a new Socket
Thanks for submitting an edit. It is only visible to you until it’s been approved by trusted community members
first, use port 465 second, get your email verified in AWS SES, and change your default sending email from here: Jenkins -> Configure System -> Jenkins Location -> System Admin e-mail address
Thanks. It helps me!
My problem was "550-Verification failed for "

Skpsmtpmessage: which server should i use for gmail

I got this project "skpsmtpmessage" and I tried to send mail first. So I changed all the mail id to gmail id. But replay host is problem. I tried smtp.gmail.com, smtp.google.com, smtp.googletalk.com. But when I run my program, I get error that "Unable to connect server"
Which relay host should I use for gmail.
The correct SMTP server for Gmail is smtp.gmail.com, but I don't know how to help you further, the question is pretty vague.
You can also take a look at the configuration instructions for using Gmail on the iPhone to see if you're making a mistake with another parameter.