Jump to content


Photo

adding file attachment functionality to automated email response


  • Please log in to reply
6 replies to this topic

#1 richtux

richtux
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 18 October 2006 - 12:04 PM

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");
?>

#2 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 18 October 2006 - 12:22 PM

don't send the body param and create the complete message (header, attachment, body) and insert that into the header param!


me!

#3 richtux

richtux
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 18 October 2006 - 12:46 PM

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");
?>

#4 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 18 October 2006 - 01:24 PM

As a function...

// removed


me!

#5 richtux

richtux
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 18 October 2006 - 02:48 PM

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

#6 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 18 October 2006 - 03:01 PM

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!

#7 richtux

richtux
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 18 October 2006 - 03:17 PM

Cool thats much better!, thanks for your help.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users