php to write attachment to email

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!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

php to write attachment to email

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php to write attachment to email

Post by Christopher »

Use SwiftMailer or see the manual page for the mail() function for examples.
(#10850)
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: php to write attachment to email

Post by someguyhere »

Yeah, I know how to send mail. I can't get it to attach the file that it writes.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php to write attachment to email

Post 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.
(#10850)
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: php to write attachment to email

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php to write attachment to email

Post 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.
(#10850)
Post Reply