コードは、画像送信と全く同じ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | mb_language( "Japanese" ); mb_internal_encoding( "UTF-8" ); $to = "ほげほげ@gmail.com" ; $subject = "Just the Way You Are" ; $filepath = "test.mp3" ; $mime_type = "application/octet-stream" ; $boundary = "__BOUNDARY__" ; $additional_headers = "Content-Type: multipart/mixed;boundary=\"" . $boundary . "\"\n" ; $message = "--" . $boundary . "\n" ; $message .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n\n" ; $message .= "When I see your face ありのままの君が 愛おしいよ Just the way you Are\n"; $message .= "--" . $boundary . "\n" ; $message .= "Content-Type:" . $mime_type . "; name=\"" . basename ( $filepath ) . "\"\n" ; $message .= "Content-Disposition: attachment; filename=\"" . basename ( $filepath ) . "\"\n" ; $message .= "Content-Transfer-Encoding: base64\n" ; $message .= "\n" ; $message .= chunk_split ( base64_encode ( file_get_contents ( $filepath ))). "\n" ; $message .= "--" . $boundary . "--" ; mb_send_mail( $to , $subject , $message , $additional_headers ); |
Gmailだと、そのままブラウザ上で聞けますね。さすが~
あ、hotmailもいけますね。
※yahooさん(yahoo mail)はダウンロードしないとダメなようですね^^