473,503 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Email attachment with word documen

21 New Member
Hi,

How to attach word document file (*.doc) in a mail ? I tried to attach it with the blow codes...

$headers .= "Content-Type: application/msword; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: ". "base64\n";
$headers .= "Content-Disposition: attachment\n\n";
$filedata = implode(file('mailattach.doc'), '');
$headers .= chunk_split(base64_encode($filedata));
mail($to, $subject, $body, $headers);

I can get attachment file from this code. But i can get only *.txt format files only not *.doc. Even the file also correpted when i download from mail. I couldn't read the content from that file. How to solve this problem ?

Thanks.
Sep 13 '07 #1
1 4346
Weisbartb
36 New Member
Hi,

How to attach word document file (*.doc) in a mail ? I tried to attach it with the blow codes...

$headers .= "Content-Type: application/msword; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: ". "base64\n";
$headers .= "Content-Disposition: attachment\n\n";
$filedata = implode(file('mailattach.doc'), '');
$headers .= chunk_split(base64_encode($filedata));
mail($to, $subject, $body, $headers);

I can get attachment file from this code. But i can get only *.txt format files only not *.doc. Even the file also correpted when i download from mail. I couldn't read the content from that file. How to solve this problem ?

Thanks.
Add
[php] $headers .="name=\"docname.doc\"\n";[/php]

After the 3rd $header.
Sep 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3721
by: Paul Schmidt | last post by:
Dear list: I am new to python, and I am trying to figure out the short answer on something. I want to open a POP3 mailbox, read the enclosed mail using the POP3 module, , and then process it...
9
1645
by: NickH | last post by:
Hi, Thanks in advance for any help you can provide. I have a frameset and one of the frames contains a page that is created on the fly, an actual word document. I want to have a button in one of...
6
1025
by: Tony Roost | last post by:
I have created a test VB.Net form that will use MS Word to check the spelling of text in an input box The test application runs without a problem and I quit the word application at the end of the...
5
15905
by: paii, Ron | last post by:
How do I setup a email with attachment for preview but require the user to push the SEND button in Outlook. I have the following function but it sends the email without the sender ever seeing it. ...
19
2753
by: Bill | last post by:
I have searched through the posts for a question like mine but have only found much more complicated responses. On single record view of a form I have an email address field. I merely want to...
0
1017
by: Bertus Dam | last post by:
I'm trying to create an e-mail with a dynamic word attachment like this: System.Web.Mail.MailAttachment cAtt = new System.Web.Mail.MailAttachment("test.aspx"); test.aspx is a webform which...
0
268
by: Novice | last post by:
Hi all, I'm a novice VB.NET and VBA programmer and am wondering if there is a tutorial out there on how to create a word document based on data in a database and then return that document to a web...
1
2056
by: John | last post by:
Hi, I have a question to ask in how to send e-mail through a program written by VB.Net with the help of MS Word and Outlook? The platform will be like this: OS - Win 2K Pro Office 2000 with...
3
2003
by: sylence | last post by:
Now I've been working on a script that sends emails with different attachments, including csv, xls, docs, txt, and html/htm files. However when attaching, some information at the top in the txt...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.