Last active
September 9, 2024 09:58
-
-
Save hdogan/8649cd9c25c75d0ab27e140d5eef5ce2 to your computer and use it in GitHub Desktop.
Revisions
-
hdogan revised this gist
Feb 25, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ function read_cb($ch, $fp, $length) { CURLOPT_USERNAME => 'username', CURLOPT_PASSWORD => 'password', CURLOPT_USE_SSL => CURLUSESSL_ALL, CURLOPT_READFUNCTION => 'read_cb', CURLOPT_INFILE => $fp, CURLOPT_UPLOAD => true, CURLOPT_VERBOSE => true, -
hdogan created this gist
Feb 25, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ <?php function read_cb($ch, $fp, $length) { return fread($fp, $length); } $fp = fopen('php://memory', 'r+'); $string = "From: <no-reply@example.com>\r\n"; $string .= "To: <hdogan@example.com>\r\n"; $string .= "Date: " . date('r') . "\r\n"; $string .= "Subject: Test\r\n"; $string .= "\r\n"; $string .= "Deneme mesaji\r\n"; $string .= "\r\n"; fwrite($fp, $string); rewind($fp); $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => 'smtps://smtp.example.com:465/example.com', CURLOPT_MAIL_FROM => '<no-reply@example.com>', CURLOPT_MAIL_RCPT => ['<hdogan@example.com>'], CURLOPT_USERNAME => 'username', CURLOPT_PASSWORD => 'password', CURLOPT_USE_SSL => CURLUSESSL_ALL, CURLOPT_READFUNCTION => 'read_db', CURLOPT_INFILE => $fp, CURLOPT_UPLOAD => true, CURLOPT_VERBOSE => true, ]); $x = curl_exec($ch); if ($x === false) { echo curl_errno($ch) . ' = ' . curl_strerror(curl_errno($ch)) . PHP_EOL; } curl_close($ch); fclose($fp);