How can I use the curl command line program to send an email from a gmail account?
I have tried the following:
curl -n --ssl-reqd --mail-from "<sender@gmail.com>" --mail-rcpt "<receiver@server.tld>" --url smtps://smtp.gmail.com:465 -T file.txt
With file.txt being the email's contents, however, when I run this command I get the following error:
curl: (67) Access denied: 530
Is it possible to send an email from an account that is hosted by a personal server, still using curl? Does that make the authentication process easier?
mail.txt file contents:
Additional info:
I’m using
curl
version 7.21.6 with SSL support.The
--insecure
switch allowscurl
to perform "insecure" SSL connections and transfers. See this online resource this online resource for further details.It’s considered a bad security practice to pass account credentials thru command line arguments. The above example is for demo purpose only.
You must turn on access for less secure apps.