/    Sign up×
Community /Pin to ProfileBookmark

PHP sendmail Script with Attachement

[B]I am having trouble learning how to a send an attachment using a PHP script. Any help is greatly appreciated. Below is my script followed by a snippet of my HTML:[/B]

<?php
$to = “[email protected]“;
$subject = “Purchase Received!”;
$email = $_REQUEST[’email’];
$mar_stat = $_
REQUEST[‘mar_stat’];
$client_name = $_REQUEST[‘client_name’];
$spouse_name = $_
REQUEST[‘spouse_name’];
$client_dob_month = $_REQUEST[‘client_dob_month’];
$client_dob_day = $_
REQUEST[‘client_dob_day’];
$client_dob_year = $_REQUEST[‘client_dob_year’];
$spouse_dob_month = $_
REQUEST[‘spouse_dob_month’];
$spouse_dob_day = $_REQUEST[‘spouse_dob_day’];
$spouse_dob_year = $_
REQUEST[‘spouse_dob_year’];
$client_income = $_REQUEST[‘client_income’];
$spouse_income = $_
REQUEST[‘spouse_income’];
$address = $_REQUEST[‘address’];
$city = $_
REQUEST[‘city’];
$state = $_REQUEST[‘state’];
$zip = $_
REQUEST[‘zip’];
$email = $_REQUEST[’email’];
$area = $_
REQUEST[‘area’];
$prefix = $_REQUEST[‘prefix’];
$phone = $_
REQUEST[‘phone’];
$contact_method = $_REQUEST[‘contact_method’];

$client_ret_age = $_REQUEST[‘client_ret_age’];
$spouse_ret_age = $_
REQUEST[‘spouse_ret_age’];
$desired_gross_inc = $_REQUEST[‘desired_gross_inc’];
$apprx_ret_invest = $_
REQUEST[‘apprx_ret_invest’];
$apprx_nonret_invest = $_REQUEST[‘apprx_nonret_invest’];
$pension = $_
REQUEST[‘pension’];
$pension_comments = $_REQUEST[‘pension_comments’];
$life_expect = $_
REQUEST[‘life_expect’];
$spouse_life_expect = $_REQUEST[‘spouse_life_expect’];
$life_expect_comments = $_
REQUEST[‘life_expect_comments’];
$work_ret = $_REQUEST[‘work_ret’];
$spouse_work_ret = $_
REQUEST[‘spouse_work_ret’];
$work_ret_comments = $_REQUEST[‘work_ret_comments’];
$inheritance = $_
REQUEST[‘inheritance’];
$inheritance_comments = $_REQUEST[‘inheritance_comments’];

$headers = “Content-type: text/html; charset=iso-8859-1rn”;
$headers .= “From: $email”;

$message = “<b>Purchase Received! Customer Infromation Form</b><br><br><b>Married?:</b> $mar_stat<br><b>Client Name:</b> $client_name<br><b>Spouse_Name:</b> $spouse_name<br><b>Client DOB:</b> $client_dob_month-$client_dob_day-$client_dob_day<br><b>Spouse DOB:</b> $spouse_dob_month-$spouse_dob_day-spouse_dob_day<br><b>Client Income:</b> $client_income<br><b>Spouse Income:</b> $spouse_income<br><br><b>Address:</b> $address<br><b>City:</b> $city<br><b>State:</b> $state<br><b>Zip:</b> $zip<br><b>Email:</b> $email<br><b>Phone:</b> $area-$prefix-$phone<br><b>Best Contact Method:</b> $contact_method<br><br><b>Desired Client Retirement Age:</b> $client_ret_age<br><b>Desired Spouse Retirement Age:</b> $spouse_ret_age<br><b>Desired Gross Income:</b> $desired_gross_inc<br><b>Approximate Retirement Investments:</b> $apprx_ret_invest<br><b>Approximate Non-Retirement Investments:</b> $apprx_nonret_invest<br><br><b>Pension:</b> $pension<br><b>Pension Comments:</b> $pension_comments<br><br><b>Client Life Expectancy:</b> $life_expect<br><b>Spouse Life Expectancy:</b> $spouse_life_expect<br><b>Life Expectancy Comments:</b> $life_expect_comments<br><br><b>Client Working in Retirement:</b> $work_ret<br><b>Spouse Working in Retirement:</b> $spouse_work_ret<br><b>Working in Retirement Comments:</b> $work_ret_comments<br><br><b>Inheritance Expected:</b> $inheritance<br><b>Inheritance Comments:</b> $inheritance_comments”;

$sent = mail($to, $subject, $message, $headers);
if($sent)
header( “Location: http://www.sspla.com/thankyou_purchase.html” );
else
header( “Location: http://www.sspla.com/sorry_purchase.html” );
?>

[B]Here is the HTML snippet:[/B]

<!– ATTACH DOCUMENTATION –>
<fieldset> <legend> <b>Attach Statement</b> </legend>
<table border=”0″ cellpadding=”2″ cellspacing=”3″>
<tr>
<td align=”left” valign=”top”>
<input type=”file” name=’statement’ maxlength=”275″ />&nbsp;<span style=”font-size: .95em;”><i>NOTE: Failure to Attach Your Statement May Result in a Delay Proccessing Your Purchase</i></span>
</td>
</tr>
</table>
</fieldset>

[B]THANKS![/B]

to post a comment
PHP

1 Comments(s)

×

Success!

Help @costamesakid07 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...