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!
I have been trying to get a form on my site that will allow the user to send an email with an attachment. I located a script thorugh a search that is supposed to allow me to do just that with php. Unfortunately the script seems to be doing everything right except sending the email. I have played with it a bit and found that the problem is somewhere in the $hdr variable, because if I remove that variable from the mail() function, it goes through fine. Of course I kind of need the $hdr variable. Here is the script. Can anyone look at how $hdr is built and see if there are any glaring issues with the code that would cause this problem?
Okay so I took a look at both of these suggestion and they were an even bigger headache. With swiftmailer I couldn't even get past step 1 (telnet to see if you can connect) I couldn't. With phpmailer The first thing it said to do was to do something to the php.ini. I am being hosted and I'm pretty sure I don't have access to the php.ini. This sounds pretty straight forward but it still took a couple of hours to realize I was not going to figure this stuff out. so I am back to my original plea as I actually seemed to get nuch fartehr with the code I originally posted. It at least sends an email when there is no header info attaced. Can anyone see a problem with how the $hdr variable is built because that seems to be what is blocking the email from going.
Skip over the telnet thing and just go straight to the code (provided you've uploaded swift to your server). That telnet thing is only in there to identify issue up-front and save me an inbox full of "swift dunnit workz" emails