我試圖使用以下curl示例發送2郵件給用戶和所有者。如果我想在php中使用以下代碼發送郵件,我將如何做到這一點?實際上,示例代碼來自名爲sendinblue的服務。我很想聽到你的消息!如何轉換curl用於發送郵件在php
curl -H 'api-key:your_access_key' -X POST -d '{"cc":["[email protected]":"cc whom!"],"text":"This is the text","bcc":["[email protected]":"bcc whom!"],"replyto":["[email protected]","reply to!"],"html":"This is the <h1>HTML</h1>This is inline image 1.<br/><img src=\"{myinlineimage1.png}\" alt=\"image1\" border=\"0\"><br/>Some text<br/>This is inline image 2.<br/><img src=\"{myinlineimage2.jpg}\" alt=\"image2\" border=\"0\"><br/>Some more text<br/>Re-used inline image 1.<br/><img src=\"{myinlineimage1.png}\" alt=\"image3\" border=\"0\">","to":{"[email protected]":"to whom!"},"attachment": {"myfilename.pdf":"your_pdf_files_base64_encoded_chunk_data"},"from":["[email protected]","from email!"],"subject":"My subject","headers":{"Content-Type":"text/html; charset=iso-8859-1", "X-param1":"value1","X-param2":"value2", "X-Mailin-custom":"my custom value","X-Mailin-IP":"102.102.1.2", "X-Mailin-Tag":"My tag"},"inline_image":{"myinlineimage1.png":"your_png_files_base64_encoded_chunk_data", "myinlineimage2.jpg":"your_jpg_files_base64_encoded_chunk_data"}}' 'https://api.sendinblue.com/v2.0/email
想送以下數據
$senddata = array (
'to' => array('[email protected]'=>'[email protected]'),
'from' => array($fromvalue,$fromvalue),
'replyto' => array("[email protected]","[email protected]"),
'subject' => "subject",
'text' => "text",
'html' => '',
'fromname' => $fromnamevalue,
'bcc' => 'bcc'
);
在(因此)我們希望你嘗試**自己編寫的代碼** 。** [做更多的研究](// meta.stackoverflow.com/questions/261592)如果你有問題,你可以**發佈你已經嘗試過的**,並清楚說明什麼是不工作**並提供[** Minimal,Complete和Verifiable示例**](// stackoverflow.com/help/mcve)。我建議閱讀[問]一個好問題和[完美問題](http ://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/)。另外,be肯定要參加[參觀]並閱讀** [this](// meta.stackoverflow.com/questions/347937/)**。 –