Page 1 of 1

php to write attachment to email

Posted: Mon Sep 22, 2008 3:58 pm
by someguyhere
I am using a fairly robust form on our website to keep spam bots out and I want to add the ability for it to take the data, compile it into a csv file and attach it to the email that the form sends us so that we can import it right into our CRM program. I've dug around some of the php info online, but I can't seem to find a good way to do it. Suggestions?

Re: php to write attachment to email

Posted: Mon Sep 22, 2008 4:14 pm
by Christopher
Use SwiftMailer or see the manual page for the mail() function for examples.

Re: php to write attachment to email

Posted: Mon Sep 22, 2008 4:44 pm
by someguyhere
Yeah, I know how to send mail. I can't get it to attach the file that it writes.

Re: php to write attachment to email

Posted: Mon Sep 22, 2008 7:42 pm
by Christopher
Use SwiftMailer or see the manual page for the mail() function for examples. I am guessing you did not look. Both have examples of doing attachments.

Re: php to write attachment to email

Posted: Tue Sep 23, 2008 8:18 am
by someguyhere
Well, if I'm still asking, it's probably because I am having difficulty sorting it out. I would imagine that someone who offers such sage advice as "read the manual" would have deduced that.

Re: php to write attachment to email

Posted: Tue Sep 23, 2008 1:27 pm
by Christopher
I understand that you are having trouble attaching a file. But you haven't said whether you checked the examples and notes in the manual page for mail() or if you tried SwiftMailer. Nor have you shown any code. I am not being flippant. MIME email is fairly non-trivial. It is not clear whether you have code that is not working, you don't get the concept at all, you want working code. The two sources I gave are what I used to learn attachments and what I use for complex emailing.