| | |
attachment in mail using php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 183
Reputation:
Solved Threads: 5
hi i have attached a mail_attachment file which contains the mail function in my code i have used the below code
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
<? include 'mail_attachment.php'; $sent = mail_attachment($from, $to, $subject1, $body1, $attachment);?>
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
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.
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.
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.
•
•
•
•
sorry,output is home/webs/public_html/profiles/9/BusinessProposal.doc
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
php Syntax (Toggle Plain Text)
mail_attachment(..., ..., ..., ..., '/home/webs/public_html/profiles/9/BusinessProposal.doc');
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:
php Syntax (Toggle Plain Text)
mail_attachment('sender@pepa.info', 'petr.pavel@pepa.info', 'test subject', 'test body', '/home/webs/public_html/profiles/9/BusinessProposal.doc');
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.
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.
![]() |
Similar Threads
- send email with attachment (PHP)
- attachment with email (PHP)
- File Attachment Small Problem (PHP)
- HELP - can't access Yahoo Mail (Viruses, Spyware and other Nasties)
- Php Attachment (PHP)
- uploading a picture (PHP)
- Sending attachements over php (PHP)
Other Threads in the PHP Forum
- Previous Thread: Array Help
- Next Thread: Popups
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail menu mlm mod_rewrite multiple mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validation validator variable video web xml youtube





