Jump to content

Archived

This topic is now archived and is closed to further replies.

richtux

adding file attachment functionality to automated email response

Recommended Posts

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 $sName
Tel: $tel
Email: $email
Company: $company
Country: $country

Please feel free to contact me directly if you have any questions.

Yours Sincerely,
xx - director
xx
Tel: xxx
Email: xxx

mail($email, $subject, $subscriberEmailBody, "From: $from");
mail($from, $subject, $subscriberEmailBody, "From: $email");
?>

Share this post


Link to post
Share on other sites
don't send the body param and create the complete message (header, attachment, body) and insert that into the header param!


me!

Share this post


Link to post
Share on other sites
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 $sName
Tel: $tel
Email: $email
Company: $company
Country: $country

Please feel free to contact me directly if you have any questions.

Yours Sincerely,
xx - director
xx
Tel: xxx
Email: xxx

mail($email, $subject, $subscriberEmailBody, "From: $from");
mail($from, $subject, $subscriberEmailBody, "From: $email");
?>

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.