Jump to content

adding file attachment functionality to automated email response


richtux

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");
?>
Link to comment
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");
?>
Link to comment
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.