Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Send SMTP email using cURL
curl --connect-timeout 15 -v --insecure "smtp://smtp.example.com:25" -u "username:password"
\ --mail-from "sender@example.com" --mail-rcpt "destination@example.com"
\ -T email-contents.txt --ssl
From: "Sender Name" <sender@example.com>
To: "Destination Email" <destination@example.com>
Subject: Sending Using Curl
Hello,
I'm sending this mail with curl.
Bye!
@mstreicher

This comment has been minimized.

Copy link

mstreicher commented Feb 11, 2016

Sorry but this dosen't work for me. i got this output:

%Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 65.55.163.152...

  • Connected to smtp.live.com (65.55.163.152) port 25 (#0)
    0 0 0 0 0 0 0 0 --:--:-- 0:00:58 --:--:-- 0* Operation timed out after 0 milliseconds with 0 out of 0 bytes received
  • Closing connection 0
    curl: (28) Operation timed out after 0 milliseconds with 0 out of 0 bytes received

can you help me?

@dimeglio

This comment has been minimized.

Copy link

dimeglio commented Mar 23, 2017

For me it seems to be working but at the very end I get the error

curl: (56) Failure when receiving data from the peer

and no message is sent (or received?)

@M0H4MM33D

This comment has been minimized.

Copy link

M0H4MM33D commented Mar 24, 2018

need open port ?

@eggypandiangan

This comment has been minimized.

Copy link

eggypandiangan commented Jun 6, 2020

How to attach file (like sss.pdf) using curl send email?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.