Jump to content

MUCH help with my mail script


crazy8

Recommended Posts

Ok this may seem overwelming but I fiugre ill get it all in one post and make everything clear just to make things easier for all of us.Ok so here is the deal I have a mail script and it works great, only there is still more i want/need to do to it. I will try to ouline everything in detail and I will post up my code figuring if you guys see what i have maybe the help will be more specific to my needs and what im using.Anyway lets get started.

1) How do I add functionality to my script so my form can send "browsed" items as attachments?

2) As you can see my script has all my form fields entered. How do I go about capturing drop down menu selctions made by the applicant?

A) even more so how can I have it display in the e-mail to display the info as "From:(month) of (year) To:(month) of (year)? [a href=\"http://65.98.16.170/~millerm/Test%20Application.php\" target=\"_blank\"]My form - the dropdowns are twords the bottom[/a]

3) How would i go about getting some of the words to be bold when e-mailed? Im trying to make it look a little bit more visualy pleasing and easier to read.Not sure what my limits are with making it "pretty" so any ideas would be awsome.

Well I do beleive that is it unless something else comes up. thank you all sooo much for the help I can not say it enough.Im doing this all for a client of mine.I want him and his business to have more then his "weekend made" site that some shmoe did for way to much money [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] anyway thank you all again so much...and here is my script

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Submiting Job Application</title>
</head>
<body>
<?
ob_start();
$email = "Client@company.com";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


if((!$firstname) || (!$lastname) || (!$address) || (!$city) || (!$state)) {
header("Location: Test Application.php?error=1");
}


//Be-low this is all the information that represents fields on the job application form that will be filled out and sent to the specified email ($email).
$subject = "Job Application Submited.\r\n";

$message .= "---Personal Information----------------\r\n";
$message .= "Firstname: " . $firstname . "\r\n";
$message .= "Lastname: " . $lastname . "\r\n";
$message .= "Address: " . $address . "\r\n";
$message .= "City: " . $city . "\r\n";
$message .= "State: " . $state . "\r\n";
$message .= "Zipcode: " . $zip . "\r\n";
$message .= "Home Phone: " . $home . "\r\n";
$message .= "Other Phone: " . $other . "\r\n";
$message .= "Cell Phone: " . $cell . "\r\n";
$message .= "Social Security Number: " . $SSN_TOTAL=$SSN1."-".$SSN2."-".$SSN3 . "\r\n";
$message .= "Email: " . $Email . "\r\n";
$message .= "Eligible to work in US: " . $eligible . "\r\n";
$message .= "-------------------------------\r\n";
$message .= "Convicted Felony: " . $convicted . "\r\n";
$message .= "Explanation: " . $explanation . "\r\n";
$message .= "-------------------------------\r\n";
$message .= "Position Applied For: " . $position . "\r\n";
$message .= "Able To Start: " . $start . "\r\n";

$message .= "---Education----------------------------\r\n";
$message .= "Name and Address of School: " . $schooladdress . "\r\n";
$message .= "Degree/Diploma: " . $degreediploma . "\r\n";
$message .= "Graduation: " . $graduation . "\r\n";
$message .= "Skills and Qualifications: " . $Skills . "\r\n";

$message .= "---Employment History----------------------------\r\n";

$message .= "---Employer1-------------------------------------\r\n";
$message .= "Name and Address: " . $nameaddress . "\r\n";
$message .= "Job Duties: " . $duties . "\r\n";
//insert period of emplyment here for Employer1
$message .= "Reason For Leaving: " . $reason1 . "\r\n";

$message .= "---Employer2-------------------------------------\r\n";
$message .= "Name and Address: " . $nameaddress2 . "\r\n";
$message .= "Job Duties: " . $duties2 . "\r\n";
//insert period of emplyment here for Employer2
$message .= "Reason For Leaving: " . $reason2 . "\r\n";

$message .= "---Employer3-------------------------------------\r\n";
$message .= "Name and Address: " . $nameaddress3 . "\r\n";
$message .= "Job Duties: " . $duties3 . "\r\n";
//insert period of emplyment here for Employer3
$message .= "Reason For Leaving: " . $reason3 . "\r\n";

$headers = "From: " . $email . "\r\n" . "Bcc: " . $bcc . "\r\n";
mail($email, $subject, stripslashes($message), $headers);


?>


<?php
//This part of the script is the instant notification that the applicant will receive after filling out the application form.  
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
function reply() {  

$rep = <<<EOD
<p><font color="#000000" size="5" face="Arial, Helvetica, sans-serif"><strong>
.:Miller Machine Company Inc. Job Application Completed :.</strong></font></p>
<p><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">
Thank you for your interest in Miller Machine Company Inc. We have received your application for employment and will evaluate it along with the information that you have submited to us.Thank you for your time and interest we will contact you after your application has been evaluated.</font></p>
<hr>
<font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><br>
Sincerly,<br>
Steve Miller and Team<br>
Miller Machine Company Inc.<br>
</font>
<div align="left"><font color="#000000" size="2" face="Arial,
Helvetica, sans-serif"><br>
  <font size="1">You are receiving this e-mail becuase you submited a
job application form at http://www.millermachinecompany.com.
  THIS IS NOT SPAM. If you did not request this, send an e-mail to
mikes@millermachinecompany.com with subject "Wrong Email" and nothing in the body. If
you would not like to receive anymore updates about this request.
</font></font><font color="#000000" size="3" face="Arial, Helvetica, sans-serif"><br>
</font>
  <hr>
  <div align="center"><font color="#000000" size="3" face="Arial,
Helvetica, sans-serif"><br>
    http://www.millermachinecompany.com</font></font><font color="#000000"
size="3" face="Arial, Helvetica, sans-serif">
</font></div>
</div>
EOD;

  return $rep;  
}  

$replymessage = reply();
$replyto = $Email; //This will send an instant notification to the applicant that we have received the online job application they filled out.    
$replysubject = "Job Application Received.\r\n";

mail($replyto, $replysubject, $replymessage, $headers);

ob_end_flush();

?>

</body>
</html>[/code]

I know its not perfect so anythin you guys see that is wrong or I dont need feel free to point it out [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
Link to comment
Share on other sites

Well figured after 3 days and 23 views this was worth a bump.Still trying to see what i can find out about all of this and so far the search isnt turning up much.As far as my form being able to send attachments the only thing I have come across is if i want to send a predefined attachment to people rther then code that would allow people to send attachments to my client. Any help at all on the above post would be greatly appreciated.

Thank you all so much.
Link to comment
Share on other sites

WOW 1 week and 34 hits on this post and NOTHING.....I find it hard to beleive that out of 34 views that not a single one of them people knew anything about any of my questions..Good thing Im not on a time schedual. Guess I will have to find a PHP forum where people actually have answers and that can help.
Thanks alot for letting me know this ISNT the place to go. Keep up the good work everyone.
Link to comment
Share on other sites

[!--quoteo(post=374513:date=May 16 2006, 08:35 PM:name=crazy8)--][div class=\'quotetop\']QUOTE(crazy8 @ May 16 2006, 08:35 PM) [snapback]374513[/snapback][/div][div class=\'quotemain\'][!--quotec--]
WOW 1 week and 34 hits on this post and NOTHING.....I find it hard to beleive that out of 34 views that not a single one of them people knew anything about any of my questions..Good thing Im not on a time schedual. Guess I will have to find a PHP forum where people actually have answers and that can help.
Thanks alot for letting me know this ISNT the place to go. Keep up the good work everyone.
[/quote]


Hmm ... i'm pretty new to thi myself mate, but, alot of the stuff your asking for i had to figure out myself, its not particularly difficult... allthough i understand how frustrating it is [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

As far as the drop down menu's go, just make sure your identified them all correctly, and then just "call" that anme with the $_POST Command ... all the layout stuff your trying to do is basic Html formatting and you should be able to figure it out by looking at the code i've posted.

Code 1. Define your drop down menu's
[code]
<b>$your_dob:</b><br>\n
        <select name=\"month\">
        <option>January
        <option>Febuary
        <option>March
</select>[/code]


Code 2. Fomatt the E-mail
[code]$msg .= "<br><b>$your_dob:</b> $_POST[month]\n";
                    $msg .= "<b>:</b> $_POST[day]\n";
                    $msg .= "<b>:</b> $_POST[year]\n<br>";[/code]

Obviously i have 2 other drop down menus'... one for day and one for year..... the above code will result in a message of the format :

[b]Your Dob:[/b] Month : Day : Year

The $your_dob variable is defined elswhere as being = to "Your Dob" ... and the [b]BOLD[/b] effect is added in the code above that formatts the message.... as you should be able to see.

If you can't figure the bold thing out..... post back and watch what happens when you highlight and select bold in this message field.... basic Html my friend.


I hope I've helped, i know how frustrating learning this on your own can be. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

Well I kinda got it working.This is the only way i can get it working so far.

[code]$message .= "From:" . "$_POST[start_month]\n";
$message .= "Of Year: " . $start_year . "\n";[/code]

Doing it your way displayed the <br> and <b> tags and had some other minor issues. Also didnt display it side by side like i would like, still doesnt but im trying to play with it see if i can figure it out. I dont realy NEED it to be in a side by side format but it would be nicer.ANother issue im having is that my mail script still isnt capturing the drop down values. I select March in the drop down and the out put in my emial say January every time. Brain fart here....is this code u gave me supposed to go into my mail script or my HTML for that page?Dunno why i just now thought of that.
Link to comment
Share on other sites

Do you have any idea how to do mail forms? I need to know how to get my form and mail script setup so my clients customers can send attachments with the form they fill out.Thats the real big stump ive hit. I have read alot but there seems to be so much in doing it that maybe you could simplify it or maybe you even have some rough code on how to do it. But its the one thing stopping me from completeing my mail script. Thanks alot for the help.
Link to comment
Share on other sites

Sorry, i'm at the level where im trying to figure the whole file attachment thing out myself mate.
I cant imagine its that difficult, and i'm planning on getting it figured out sometime next week... after i learn all about multi page forms and "hidden Fields"... (ick much typing).

As for your drop down menus, i cant understand why they donet work if you did what i said above. mine work fine in exactly that syntax.

The form im working on at the moment is made up of 2 seperate files. The first is inbedded into the .php page that i want displayed, and the other is just code.

Basically ive put all my definitions of variables..eg:

[code]$your_sex = "Your Sex";[/code]

Into the second file, and just used the "include" statement in the first file to make sure the server reads it. There's no mechanical reason why this should be any differant than simply putting everything into one file, but, it does make things a lot cleaner, for me at least.

So, lets assume we were doing a simple drop down menu, for finding someones sex out, the menu itself would be defined by;
[code]
<b>$your_sex:</b><br>\n
<select name=\"sex\">
<option>Male
<option>Female
</select>[/code]

And the message would be selected, formatted and mailed by;
[code]

$msg .= "<br><b>$your_sex:</b> $_POST[sex]\n";[/code]

All three parts are needed in order for the above code to woek, you can either put all three in the main page, or, as i have use 2 (or more) seperate files and the "include" statement.

[code]include("define.php");[/code]

This "include" goes on your main page, directly after your opening (<?) php tag.

Hope this helps a bit, sorry about the attachment thing, if i figure it out ill let you know asap.
Link to comment
Share on other sites

[quote name='crazy8' date='May 17 2006, 07:20 PM' post='374824']
[code]
$message .= "From:" . "$_POST[start_month]\n";
$message .= "Of Year: " . $start_year . "\n";[/code]


in the above code your have a space "_" in your POST name.... this is wrong, try something along the lines of,
[code]"$_POST{start]\n";[/code]

Basically keep them as short and sweet as possible, i had this problem for a while, only just noticed it when reading through my previous post.

The second line should also have the $_POST statement in it i think.

Assuming you have 2 drop down menu's.. one for month and one for year, and they looked (simplified) like this;

[code]<b>$start_date:</b><br>\n

<select name=\"month\">
<option>January
<option>Febuary
<option>March
</select>[/code]

And;

[code]<select name=\"year\">
<option>1930 <option>1931 <option>1932 <option>1933
</select>[/code]

First i have used $start_date on the first drop down to actually name the menu's on the web page, this means i must define $start_date somewhere else, so;

[code]$start_date = "Date You Started";[/code]

So on the webpage this menu will have a title of "Date Your Started"

Now, when someone fills the form in i assume, you want it to display "in-line" with maybe a colon seperating the year : month : day : etc.

to do this with the above table, and to have the headings in bold use the following code;

[code]$msg .= "<br><b>$start_date:</b> $_POST[month]\n";
$msg .= "<b>:</b> $_POST[year]\n";[/code]

if that doesnt work, check for syntax errors... [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

Well i got it working now. I didnt have to do anything to my form all i had to do was enter this in to my mail script.
[code]$message .= "From:" . "$_POST[smonth]" .  "/" . "$_POST[syear]\n";
$message .= "To:" . "$_POST[emonth]" .  "/" . "$_POST[eyear]\n";[/code]

May not be exactly what you recomended but it works and you still helped in giving me ideas on what tto try.But yea like i said it works now perfectly. Thankx alot for your help.

Also with the attachment deal. Are you trying to set it up where people send a form with an attachment that they have browsed for on their computers? If so thats what im trying to do so if you figure it out please let me know what you did and what the script looks like. That would be a HUGE push for me that would be greatly appreciated.

Again thanks alot for your help
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.