php - (solved) sending mail with attachment trouble -
i have problem sending of mails attachment. have function:
function mail_att($to, $subject, $message, $anhang) { $absender = "sender"; $absender_mail = "noreply@example.org"; $reply = "noreply@example.org"; $path = $anhang; $uploadname = "anhang.pdf"; $trenner = md5( time() ); // mail header $mailheader = "reply-to: " .$absender. "<" .$absender_mail. ">\r\n"; $mailheader .= "return-path: ".$absender_mail."\r\n"; $mailheader .= "message-id: <".$absender_mail.">\r\n"; $mailheader .= "x-mailer: php v" .phpversion(). "\r\n"; $mailheader .= "from: ".$absender."<".$absender_mail.">\r\n"; $mailheader .= "mime-version: 1.0\r\n"; $mailheader .= "content-type: multipart/mixed;\r\n"; $mailheader .= " boundary = " .$trenner; $mailheader .= "\r\n\r\n"; // mailbody $mailbody = "this multi-part message in mime format\r\n"; $mailbody .= "--" .$trenner. "\r\n"; $mailbody .= "content-type: text/html; charset=utf-8\r\n"; $mailbody .= "content-transfer-encoding: 8bit\r\n\r\n"; $mailbody .= $message. "\r\n\r\n"; // attachment $mailbody .= "--" .$trenner. "\r\n"; $mailbody .= "content-type: application/pdf; name=\"" .$uploadname. "\"\r\n"; $mailbody .= "content-transfer-encoding: base64\r\n"; $mailbody .= "content-disposition: attachment; filename=\"" .$uploadname. "\"\r\n\r\n"; $mailbody .= chunk_split( base64_encode( file_get_contents( $path ) ) ); $mailbody .= "\n"; // send mail( $to, htmlspecialchars( $subject ), $mailbody, $mailheader ); }
but when want send mail, nothing. where's problem? i'm sure enter right receiver email! , there no problem mail-server because normal emails work fine.
// edit: oh never thought use phpmailer. makes simplier , works. work nothing. @ all!
your'e using php's built-in mail()
function send message.
so, php attempt send message through local mta running on same server php running on, specified sendmail_path
in php.ini
file. first place in logs of local mta.
these should tell
- whether or not local mta received message php script , if so,
- what happened when local mta attempted deliver message remote mta.
Comments
Post a Comment