473,786 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sending mail attachment in php

26 New Member
Hi all,

I got problem in sending email with image file attached. the problem is that i can't see the image, apart from that i also try to attach a txt file and it gave me no luck. the txt file in the mail attachment is empty.

Tha following is my code, i hope somebody can help me out.
[PHP]
$file="Globe.gi f";
$fp = fopen($file,"r" );
$fcontent = fread($fp ,filesize($file ));


fclose($fp);
$content = chunk_split(bas e64_encode($fco ntent));

echo $fcontent;
$sep = md5(time());

$name = basename($file) ;

$headers = "From:kencana@k esuma.com\r\n";
$headers .= "Reply-To:kencana@kesu ma.com\r\n";

$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=$sep";


$body = "--$sep\n";
$body .= "Content-Type: text/plain;\n";
$body .= "Content-Transfer-Encoding: 8bit\n\n";
$body .= "Hello There!\n";
$body .= "--$sep\n";
$body .= "Content-Type: image/gif; name=\"$file\"\ n";
$body .= "Content-Transfer-Encoding: base64;\n";
$body .= "Content-Disposition: attachment; filename=\"$fil e\"\n";
$body .= "$content\n ";
$body .= "--$sep--";

mail("kencana@k esuma.com","Thi s is the subject",$body, $headers);
[/PHP]

Thank you very much

Regards,
Kencana
Mar 23 '07 #1
0 1736

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

Similar topics

0
1488
by: Dragos Marian Barbu | last post by:
Recently I tried to develop a function to help me sending e-mail messages with more than one attachment. Everything is working OK when I am sebding messages with one attachment, but when I try to send more than one file as attachment I get the following error: -------- Error ----------------- Could not access 'CDO.Message' object. at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object args) at...
6
2751
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
6
2534
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario, I'm having trouble writing to the server's event log. Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group on
3
2363
by: dnuos | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Here's some details: Server and client computers both in the same workgroup Logged into server as local Administrator Logged into client as a local user that is only in the Users group on the client computer
6
11296
by: Rushwire | last post by:
Does anybody know how to send a meeting request using an ics/vcs (VCalendar) attachment from an asp.net page. I don't want my users to have to double click on the attachment but rather that it is simply recognised automatically as a meeting request. The article below shows an example of very close to what I am trying to do. The difference being that I want the email to be sent as a meeting request not as an attached ics file.
2
4560
by: prasenjit2007 | last post by:
Hello, can u help me sending Email with attachments using the Class phpMailer. On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name) 2)To 3) Subject 4) Message5) File input(name abc) - to be sent as an attachment. This form calls the Class PhpMailer through another form with the following code to send the mail. <?php ini_set("include_path",...
7
8560
by: Paridevi | last post by:
Hai , i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have searched a lot in Google, but ican't get any details. Pls its urgent for me. Can any one give me any idea about this. Thanks in advance Pari
3
2396
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is not authorized" i have configure smtp server put 127.0.0.1 ip in relay and also put 127.0.0.1 ip in connection. using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing;
3
2712
by: virtualweb | last post by:
Hello: I need to send a bit of HTML and Javascrpt on the body of an email from my perl script in order to have the recipient get a link that will openup a new window with a PopUp. For some reason instead of receiving the email with the HTML showing a link that will open up my PopUp... Im getting all the HTML tags and javasacript code printed on my email. What am I doing wrong..?? Here is the code:
1
6148
maliksleo
by: maliksleo | last post by:
hi i am using the following class for email sending but getting this error "Failure sending mail" Imports System.Net.Mail Public Class MailHelper ''' <summary> ''' Sends an mail message ''' </summary> ''' <param name="from">Sender address</param> ''' <param name="recepient">Recepient address</param>
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9961
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.