|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
mime->addattachment
Hi,
I have a problem about sending e-mail with attachment. I'm using Pear Mime->addattachment and I can receive mail as a HTML format with no problem but not as TEXT format. When I receive e-mail as TEXT format, nothing displayed. Please check my script and Help me!!! -------------------------------------------------------------- My environments are windows2000/Linux /PHP Version 4.3.8/Pear Mail.php,v 1.9/mime.php,v 1.35 -------------------------------------------------------------- Script is require_once('Mail/Mail-1.1.4/Mail.php'); require_once('Mail_Mime/mime.php'); $to = "hoge@hoge.co.jp";; $from = "from@hoge.com";; $subject = "To Administrator"; $attachment="/home/dir.../applicants.csv"; $html = '<html><body>HTML version of email</body></html>'; $crlf = "rn"; $headers = array('From'=>$from,'Subject'=>$subject); $textMessage ="Dear Sir/Madam:nn"; $mime = new Mail_mime($crlf); $mime->_build_params['text_encoding'] ='quoted-printable'; $mime->_build_params['text_charset'] = "ISO-2022-JP";//Using Japanese $mime->_build_params['html_charset'] = "ISO-2022-JP";//Using Japanese $mime->setTXTBody($textMessage); $mime->setHTMLBody($html); $mime->addAttachment($attachment,'application/x-csv','applicants.csv',true,'base64'); $body = $mime->get(); $hdrs = $mime->headers($headers); $body = mb_convert_encoding($body, "JIS","EUC-JP"); $mail = & Mail::factory('mail'); $mail->send($to,$hdrs,$body); ------------------------------------------------ I received e-mail by Mozilla Thanderbird ver.1.0. No attachment and no message but sender name, receiver name and subject are correct. If I receive it by Outlook2000: No attachment, message is message source like below. If I receive it by MSN hotmail, NO problem. Attachment is attached and html msg is displayed. Here is mail source.------------------------------------------- To: hoge@hoge.co.jp Subject: To Administrator MIME-Version: 1.0 From: from@hoge.com Content-Type: multipart/mixed; boundary="=_0fcdfae888fc31777ccc1c196dd64403" --=_0fcdfae888fc31777ccc1c196dd64403 Content-Type: multipart/alternative; boundary="=_6c439d99379e52e28765a4c04fe854ba" --=_6c439d99379e52e28765a4c04fe854ba Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: quoted-printable Dear Sir/Madam: --=_6c439d99379e52e28765a4c04fe854ba Content-Type: text/html; charset="ISO-2022-JP" Content-Transfer-Encoding: quoted-printable HTML version of email --=_6c439d99379e52e28765a4c04fe854ba-- --=_0fcdfae888fc31777ccc1c196dd64403 Content-Type: application/x-csv Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="applicants.csv" Tk8uLFByZXNlbnRhdGlvbiBUaX... Thanks. Manbo |
|
#2
|
||||
|
||||
|
RE: mime->addattachment
The plain text part is being sent:
Quote:
Maybe it is a problem with your email reader? Are you displaying the email as plain text? Outlook can sometimes be a pain with char sets. My with utf8 charset emails - in order to be seen by outlook had to be utf-8. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > mime->addattachment |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|