{"id":13287,"date":"2020-02-17T14:55:23","date_gmt":"2020-02-17T13:55:23","guid":{"rendered":"https:\/\/daniel.haxx.se\/blog\/?p=13287"},"modified":"2020-02-17T14:55:23","modified_gmt":"2020-02-17T13:55:23","slug":"curl-ootw-mail-from","status":"publish","type":"post","link":"https:\/\/daniel.haxx.se\/blog\/2020\/02\/17\/curl-ootw-mail-from\/","title":{"rendered":"curl ootw: &#8211;mail-from"},"content":{"rendered":"\n<p>(older <a href=\"https:\/\/daniel.haxx.se\/blog\/2020\/01\/07\/curl-option-of-the-week\/\">options of the week<\/a>)<\/p>\n\n\n\n<p><code><a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html#--mail-from\">--mail-from<\/a><\/code> has no short version.  This option was added to curl 7.20.0 in February 2010.<\/p>\n\n\n\n<p>I know this surprises many curl users: yes curl can both send and receive emails.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SMTP<\/h2>\n\n\n\n<p>curl can do &#8220;uploads&#8221; to an SMTP server, which usually has the effect that an email is delivered to somewhere onward from that server. Ie, curl can send an email.<\/p>\n\n\n\n<p>When communicating with an SMTP server to send an email, curl needs to provide a certain data set and one of the mandatory fields of data that is necessary to provide is the email of the sender.<\/p>\n\n\n\n<p>It should be noted that this is not necessary the same email as the one that is displayed in the <code>From:<\/code> field that the recipient&#8217;s email client will show. But it <em>can<\/em> be the same.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">curl <strong>--mail-from<\/strong> from@example.com --mail-rcpt to@example.com smtp:\/\/mail.example.com -T body.txt<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Receiving emails<\/h2>\n\n\n\n<p>You can use curl to receive emails over POP3 or IMAP. SMTP is only for delivering email.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related options<\/h2>\n\n\n\n<p><code><a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html#--mail-rcpt\">--mail-rcpt<\/a><\/code> for the recipient(s), and <code><a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html#--mail-auth\">--mail-auth<\/a><\/code> for the authentication address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(older options of the week) &#8211;mail-from has no short version. This option was added to curl 7.20.0 in February 2010. I know this surprises many curl users: yes curl can both send and receive emails. SMTP curl can do &#8220;uploads&#8221; to an SMTP server, which usually has the effect that an email is delivered to &hellip; <a href=\"https:\/\/daniel.haxx.se\/blog\/2020\/02\/17\/curl-ootw-mail-from\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">curl ootw: &#8211;mail-from<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":13041,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[33,423,486],"class_list":["post-13287","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-curl","tag-curl-and-libcurl","tag-mail","tag-option-of-the-week"],"_links":{"self":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/13287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/comments?post=13287"}],"version-history":[{"count":6,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/13287\/revisions"}],"predecessor-version":[{"id":13436,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/13287\/revisions\/13436"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media\/13041"}],"wp:attachment":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media?parent=13287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/categories?post=13287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/tags?post=13287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}