PHP E-Mail Code *Complex*

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
cedartree
Forum Newbie
Posts: 10
Joined: Thu Dec 04, 2008 1:35 pm

PHP E-Mail Code *Complex*

Post by cedartree »

I have a web form in which a client will select their Account Executive from a dropdown list.
One tricky part is that the 'AccountExecutive' will have a name only, not an e-mail, so I will have to have the e-mail automatically populated from a seperate code if at all possible.

I would like, upon completion of the form, to have an automatic response automatically e-mail the following people:
my processor's e-mail (this is where the form is submitted to), broker's email (to be filled out in the form), AE's email (their name is selected from a drop down).

if you lost me at this point i will just draw out the process real quick:
1. client fills out form
2. FORM GETS SUBMITTED TO PROCESSOR & AE (name is selected from drop down but email needs to feed in from that name)
3. AUTOMATIC THANK YOU RESPONSE GETS SENT TO AE, BROKER, AND CLIENT'S EMAIL

we are using PHP E-Mail 2.0. i will spare you the unnecessary info:

Code: Select all

 
<?php
 
 
include('class.Email.php');
  
$total_contents .=  "Broker E-Mail: " . $_POST['BrokerEmail'] . "\n\n";
$total_contents .=  "Account Executive: " . $_POST['AccountExecutive'] . "\n\n"; 
$total_contents .=  "Client E-Mail Address: " . $_POST['email'] . "\n\n";
;
 
 //echo $total_contents ; 
 
 
$to="processing@processoremail.com";
$subject="Form submission";
 
$notify_subject = "Form Submission";
 
$from = "processing@processoremail.com";
$notify_message = "There has been a feedback";
$visitor_message = "Thanks for writing to us. We will get back to you at the earliest. 
                Hoping of a long term business relationship with you.
                ";  
 
mail( "processing@processoremail.com", "$notify_subject", "$total_contents", "$from");
//mail( "$to", "$notify_subject", "$total_contents", "$from");
header("Location:thank-you.html");
exit();
?>
 
cedartree
Forum Newbie
Posts: 10
Joined: Thu Dec 04, 2008 1:35 pm

Re: PHP E-Mail Code *Complex*

Post by cedartree »

*bump*
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: PHP E-Mail Code *Complex*

Post by Eran »

I'm sure there is a question somewhere in your post, I just can't find it. There are other strange things as well:
- You include 'class.Email.php' but don't use it, instead relying on the native mail() function.
- What is PHP E-Mail 2.0? don't assume we know about every custom package someone has released
- You pass the "From" address as the fourth parameter to the mail() function, though that parameter is for headers in general (You need to add 'From: ' before the address). Read more in the manual (which should answer most of your questions) - http://www.php.net/manual/en/function.mail.php
Post Reply