attachment in mail using php

Reply

Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

attachment in mail using php

 
0
  #1
Mar 12th, 2008
hi i have attached a mail_attachment file which contains the mail function in my code i have used the below code
<? 
include 'mail_attachment.php';
 $sent = mail_attachment($from, $to, $subject1, $body1, $attachment);?>
when i tried printing the variable ..........all the values are getting printed but the mail function is not working
it is not working.showing 2 warning

Warning: filesize() [function.filesize]: stat failed for http://www.website.com/profiles/resumes/158/llllll.doc in /home/website/public_html/mail_attachment.php on line 17

Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/website/public_html/mail_attachment.php on line 17
Attached Files
File Type: php mail_attachment.php (2.1 KB, 34 views)
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 100
Reputation: petr.pavel is an unknown quantity at this point 
Solved Threads: 14
petr.pavel's Avatar
petr.pavel petr.pavel is offline Offline
Junior Poster

Re: attachment in mail using php

 
0
  #2
Mar 12th, 2008
Hi Lydia, I guess that you're calling mail_attachment() with wrong information in $attachment parameter.
You're passing url while it should be a full path in the server's file system.
E.g.
/var/www/vhosts/website.com/httpdocs/profiles/resumes/....
or
./profiles/resumes....
You have to find out yourself what the path is (I don't know where your calling script (not the library) is located.
In case relative path doesn't work and you need to use absolute path try out phpinfo() command.

If I'm wrong in my assumption then please post what are mail_attachment() parameters when you call it.
Petr 'PePa' Pavel

The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: attachment in mail using php

 
0
  #3
Mar 13th, 2008
hi the path is getting printed correctly when i tried echo statement
eg my wesite name is webs

when i tried printing the pathname,i got the below path as output
home/webb/public_html/profiles/9/BusinessProposal.doc
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: attachment in mail using php

 
0
  #4
Mar 13th, 2008
sorry,output is home/webs/public_html/profiles/9/BusinessProposal.doc
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 100
Reputation: petr.pavel is an unknown quantity at this point 
Solved Threads: 14
petr.pavel's Avatar
petr.pavel petr.pavel is offline Offline
Junior Poster

Re: attachment in mail using php

 
0
  #5
Mar 13th, 2008
Originally Posted by lydia21 View Post
sorry,output is home/webs/public_html/profiles/9/BusinessProposal.doc
Mhm... I really doubt that.
The first error means that it cannot get file size for file:
http://www.website.com/profiles/resumes/158/llllll.doc
The file path is taken directly from the function call, so it is what you pass to the function.

But you claim that you call it with
  1. mail_attachment(..., ..., ..., ..., '/home/webs/public_html/profiles/9/BusinessProposal.doc');
(path like this must start with /, you forgot about it in your post)

If I ignore the fact that profiles/resumes/158/llllll.doc plainly isn't profiles/9/BusinessProposal.doc, even then I don't believe you are giving me what you called the function with. I'm sure you think you do but then you most likely have a bug in the program that calls the function, not the function itself.
There is no silent translation from /home/... to http://....
Your script is passing http://... and not /home/...

Try creating a new file with only include and a function call like this:
  1. mail_attachment('sender@pepa.info', 'petr.pavel@pepa.info', 'test subject', 'test body', '/home/webs/public_html/profiles/9/BusinessProposal.doc');
And double check that the file really exist.

I'll let you know if I receive the file. Also post error messages if you receive any.
Petr 'PePa' Pavel

The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC