如何将此电子邮件数据以表格格式放置?

时间:2018-03-20 02:43:17

标签: php forms email

我目前通过php电子邮件从表单接收数据如下......

$message = "$groomName and $brideName ; $weddingDate \n 
How did you hear?: $howDidYouHear \n 
~WEDDING INFO~ \n Date of Wedding: $weddingDate \n 
Time of Wedding: $weddingTime \n 
Location of Ceremony: $ceremonyLocation \n 
Location of Reception: $receptionLocation \n 
Additional Locations: $additionalLocation \n 
# of Guests: $guests \n 
~BRIDE INFO~ \n Bride's Name: $brideName \n 
Bride's Cell: $brideCell \n 
Bride's Email: $brideEmail \n 
Bride's Address: $brideAddress \n 
# of Bridesmaids: $bridesMaidsNum \n 
Names of Bridesmaids: $bridesMaidsNames \n 
Location of Bride Prep: $bridePrep \n 
~GROOM INFO~ \n 
Groom's Name: $groomName \n 
Groom's Cell: $groomCell \n 
Groom's Email: $groomEmail \n 
Groom's Address: $groomAddress \n 
# of Groomsmen: $groomsmenNum \n 
Names of Groomsmen: $groomsmenNames \n 
Location of Groom Prep: $groomPrep \n 
~KEY NAMES~ \n 
Maid of Honor: $maidOfHonor \n 
Best Man: $bestMan \n 
Bride's Parents: $brideParents \n 
Groom's Parents: $groomParents \n 
Flower Girl: $flowerGirl \n 
Ring Bearer: $ringBearer \n 
KEY DETAILS \n 
Ceremony Setting: $setting \n 
Ceremony Restrictions: $restrictions \n 
Details: $details \n 
3 Emotions: $emotions \n 
Shoot Type: $shootType \n 
Location of Family Photos: $familyPhotos \n 
Do You Know What a First Look is?: $knowFirstLook \n 
Will there be a first look?: $firstLook \n 
Important Photos: $importantPhotos \n 
What to incorporate: $incorporate \n ".  

我希望收到html格式的电子邮件,如下所示......

<table width="600px" cellpadding="2" border="1" cellspacing="0" style="font-size:12px; border:1px solid black">
        <tr><td colspan="4" style="background:black; color:white; text-align:center; font-size:18px;">Pre-Wedding Questionnaire</td></tr>
        <tr><th colspan="3"  style="font-size:16px;">$brideName and $groomName</th><th width="25%" style="font-size:16px;">$weddingDate</th></tr>
        <tr><td width="25%" style="text-align:left; font-weight:bold;">How did you hear:</td><td colspan="3">$howDidYouHear</td></tr>
        <tr><td colspan="4" align="left" style="font-size:14px; font-weight:bold; font-family:Helvetica, sans-sarif; padding-left:40px;">~Wedding Info~</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Date of Wedding:</td><td colspan="3">$weddingDate</td></tr>
        <tr><td style="text-align:left; font-weight:bold;">Time of Wedding:</td><td colspan="3">$weddingTime</td></tr>
        <tr><td style="text-align:left; font-weight:bold;">Location of Ceremony:</td><td colspan="3">$ceremonyLocation</td></tr>
        <tr><td style="text-align:left; font-weight:bold;">Location of Reception:</td><td colspan="3">$receptionLocation</td></tr>
        <tr><td style="text-align:left; font-weight:bold;">Additional Location:</td><td colspan="3">$additionalLocation</td></tr>
        <tr><td style="text-align:left; font-weight:bold;"># of Guests:</td><td colspan="3">$guests</td></tr>
        <tr><td colspan="4" align="left" style="font-size:14px; font-weight:bold; font-family:Helvetica, sans-sarif; padding-left:40px;">~Bride Info~</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Bride"s Name:</td><td colspan="3">$brideName</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Bride"s Cell:</td><td colspan="3">$brideCell</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Bride"s Email:</td><td colspan="3">$brideEmail</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Bride"s Address:</td><td colspan="3">$brideAddress</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;"># of Bridesmaids:</td><td colspan="3">$bridesMaidsNum</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Names of Bridesmaids:</td><td colspan="3">$bridesMaidsNames</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Location of Bride Prep:</td><td colspan="3">$bridePrep</td></tr>
        <tr><td colspan="4" align="left" style="font-size:14px; font-weight:bold; font-family:Helvetica, sans-sarif; padding-left:40px;">~Groom Info~</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Groom"s Name:</td><td colspan="3">$groomName</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Groom"s Cell:</td><td colspan="3">$groomCell</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Groom"s Email:</td><td colspan="3">$groomEmail</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Groom"s Address:</td><td colspan="3">$groomAddress</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;"># of Groomsmen:</td><td colspan="3">$groomsmenNum</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Names of Groomsmen:</td><td colspan="3">$groomsmenNames</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Location of Groom Prep:</td><td colspan="3">$groomPrep</td></tr>
        <tr><td colspan="4" align="left" style="font-size:14px; font-weight:bold; font-family:Helvetica, sans-sarif; padding-left:40px;">~Key Names~</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Maid of Honor:</td><td colspan="3">$maidOfHonor</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Best Man:</td><td colspan="3">$bestMan</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Bride"s Parents:</td><td colspan="3">$brideParents</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Groom"s Parents:</td><td colspan="3">$groomParents</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Flower Girl:</td><td colspan="3">$flowerGirl</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Ring Bearer:</td><td colspan="3">$ringBearer</td></tr>
        <tr><td colspan="4" align="left" style="font-size:14px; font-weight:bold; font-family:Helvetica, sans-sarif; padding-left:40px;">~Key Details~</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Ceremony Setting:</td><td colspan="3">$settings</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Ceremony Restrictions:</td><td colspan="3">$restrictions</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Details:</td><td colspan="3">$details</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">3 Emotions:</td><td colspan="3">$emotions</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Shoot Type:</td><td colspan="3">$shootType</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Location of Family Photos:</td><td colspan="3">$familyPhotos</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Do you know what a first look is:</td><td colspan="3">$knowFirstLook</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Will There Be a First Look:</td><td colspan="3">$firstLook</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">Important Photos:</td><td colspan="3">$importantPhotos</td></tr>
        <tr><td width="20%" style="text-align:left; font-weight:bold;">What to incorporate:</td><td colspan="3">$incorporate</td></tr>
</table>

我已经尝试过观看100万个论坛和教程,试图通过0运气和很多挫折来解决这个问题。请有人帮我指导一下。我提前非常感谢你。

0 个答案:

没有答案