Jump to content

Sending attachments via a PHP email script


Belfunk

Recommended Posts

Hello,

 

I am using Pear and its mime package to send an email with an attachment. The email sends properly but the attachment does not. I added a error function to see what the problem is and it says:

 

File is not readable /root/Desktop/sample.txt

 

A snippet of my code for it is:

 

$mime = new Mail_mime($crlf);

$crlf = "\r\n";

$status = $mime->addAttachment("/root/Desktop/sample.txt", "text/plain");

 

$mail = $smtp->send($to, $hdrs, $body);

 

I have defined $to and $hdrs. I have set the permissions to 777. I dont know what the problem is. Any ideas? It will be much apperciated! Also, is this the easiest way to send attachments? All I need to do is just send one attachment to one email address.

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.