PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
HI, got this code already.. problem is it only attached the first file. I tried putting //*** Attachment ***// code twice but getting error headers already sent. can someone help me with this.. thank you.
It's been a while since I did this by hand (I use phpMailer for anything that needs that now), but I believe the answer is that you need a unique separator ($strSid) for each section. I may be wrong, but that may be it.
Using phpMailer does make it easier, and they have solid code for everything you need. You can DL it here (http://sourceforge.net/projects/phpmail ... er%20v5.1/ ) Although it looks like a ton of things in it, all you need to actually put on your site is the class.phpmailer.php file. The examples directory in that download has good example of how to use it for various situations.
You can also use Zend Framework. You don't need the whole framework, but you might want to start with the whole thing and after you get used to it, remove the unnecessary stuff.
here's the entire php .. I didn't paste the html form, but there will be 2 file upload there.. please help me, for I spent days already to figure this out.
code removed
Last edited by prue_ on Fri Sep 09, 2011 9:52 am, edited 1 time in total.
First of all, you might want to hide your private key and other private stuff...
If I am not mistaken, you need to append the files to the message body ($messagebody) and not to the headers ($strHeader) like you are doing right now.
In the PHP manual for mail() there is a comment with the following function:
Hi ok, thank you fro reply, tried it already but it didn't attached anything. can you help me on where to put it exactly. thank u for your reminder too.. I just removed my codes forgot that there were private stuffs there.. thank you, hope you could still help me..
Put the function I posted in my last post in your PHP file, and call it where you want to send an email.
The function will take care of everything. However, you will need to modify the subject and message variables to your needs.
For start, try to use the function as is, without changing anything. After you test it and it works, change the subject and message variables.
Just to help you getting started:
[text]
$to - String, the email address to send the mail to
$files - Array of file paths to attach to the mail
$sendermail - String, the email address which will be used as the sender
[/text]
thanks got a question here $files.. how can I do this, I have two file upload in my html form.. how can I call it? thanks.. thank you for your patience
Hi ok, it's not working, maybe I've done it the wrong way so I pasted the entire code here for I'm not good with this.. can you check? thank you once again.
code removed
Last edited by prue_ on Mon Sep 12, 2011 7:57 am, edited 1 time in total.