richtux Posted October 18, 2006 Share Posted October 18, 2006 Hi There,Im looking to add a file attachment to this automated email response. Does anybody know where I would add this in the PHP code below? Appreciate any help that I can get, thanks. <?php$today = date("F j, Y, g:i a");$from = 'info@xx.com';$mailto = 'rich@xx.com' ;$subject = "xxx";$fileatt = "/information pack";$fileatttype = "application/doc"; $fileattname = "information pack.doc";$subscriberEmailBody ="Dear $fName,Thank you for your enquiry. We have pleasure in enclosing some information about investments in Facestation.We have recorded your details as:Name: $fName $sNameTel: $telEmail: $emailCompany: $companyCountry: $countryPlease feel free to contact me directly if you have any questions.Yours Sincerely,xx - directorxxTel: xxxEmail: xxxmail($email, $subject, $subscriberEmailBody, "From: $from");mail($from, $subject, $subscriberEmailBody, "From: $email");?> Quote Link to comment Share on other sites More sharing options...
printf Posted October 18, 2006 Share Posted October 18, 2006 don't send the body param and create the complete message (header, attachment, body) and insert that into the header param!me! Quote Link to comment Share on other sites More sharing options...
richtux Posted October 18, 2006 Author Share Posted October 18, 2006 Thanks for your swift response :), I am completely new to this. Would that mean I would have to restructure the code below to add this functionality? If so would you have an example?<?php$today = date("F j, Y, g:i a");$from = 'info@xx.com';$mailto = 'rich@xx.com' ;$subject = "xxx";$subscriberEmailBody ="Dear $fName,Thank you for your enquiry. We have pleasure in enclosing some information about investments in Facestation.We have recorded your details as:Name: $fName $sNameTel: $telEmail: $emailCompany: $companyCountry: $countryPlease feel free to contact me directly if you have any questions.Yours Sincerely,xx - directorxxTel: xxxEmail: xxxmail($email, $subject, $subscriberEmailBody, "From: $from");mail($from, $subject, $subscriberEmailBody, "From: $email");?> Quote Link to comment Share on other sites More sharing options...
printf Posted October 18, 2006 Share Posted October 18, 2006 As a function...// removedme! Quote Link to comment Share on other sites More sharing options...
richtux Posted October 18, 2006 Author Share Posted October 18, 2006 Why all the extra code etc?,...I simply want to add an attachment to an auto response email, seems to be an unnecessary amount of code, there must be a simpler method, using the existing PHP?kind regards Rich Quote Link to comment Share on other sites More sharing options...
printf Posted October 18, 2006 Share Posted October 18, 2006 The PHP mail function is a simple function to send a text based message, there is no options to have any give and take with the mail server or mail agent (AUTH, give exact error when there is a error, send to more than 1 person), so there is no way to send extra data like attachments or inline attachments without creating a method to do it your self. If my example has to much code, then your missing the point of my example. Your the one who asked the question, so it tells me you don't understand what the mail function does, so I gave you a reusable function that shows you a simple way of doing what you want, but I guess you can't learn anything from my example so I will removed it!me! Quote Link to comment Share on other sites More sharing options...
richtux Posted October 18, 2006 Author Share Posted October 18, 2006 Cool thats much better!, thanks for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.