PHP confirmation email -
i have registration form on website, upon completion details stored on csv file want send confirmation email user. issue email arrives blank, have done created template.php
file contains email structure want send out, within template structure have function other file determines registration date. template within template.php
wrapped within function call in from_to_csv.php
part of mail() atrebiutes:
hopefully makes sense , guys understand me have @ code:
template.php:
<?php function getmailcontent(){ $subject = "opes academy- workshop confirmation"; $message = " <body style='background-color: #eeeeee; margin: 0 auto; font-family: 'lato',sans-serif'> <table style='background-color:#ffffff' width='600' heigth='auto' cellspacing='0' cellpadding='0' align='center'> <tr> <td> <table width='600' style='background-color: #5e8ab5;' align='center' cellpading='0' cellspacing='0'> <tr> <td> <p style='padding-left: 20px;'><img src='http://opesacademy.com/emails/images/logo.png' width='100' alt='opes academy'></p> </td> <td style='text-align: right; padding-right: 10px; color: #ffffff'> knowledge | wealth | power </td> </tr> </table> </td> </tr> <tr> <td style='padding: 10px;'> <h1 class='skinytxt text-center txtblue'>thank reserving place</h1> <p> </p> <p class='txt-white text-center'>thanks registration, looking forward see @ the"; ?> <?php require('helper.php'); echo convertdate( $_session['date'] ); ?> <?php $message.=" <p align='center'>address: 6 thomas more square, london, e1w 1xz</p> </p> <p class='txt-white text-center'>if have more questions glad you, call on 020 3675 9000 or email on support@opesacademy.com</p> </td> </tr> </table> <table width='600' style='background-color: #5e8ab5;' align='center' cellpading='0' cellspacing='0'> <tr> <td> <p style='padding-left: 10px; padding-right: 10px; font-size: 10px'>trading , investing involves high degree of risk. past results not indicative of future returns , financial instruments can go down resulting in receiving less invested. not assume recommendations, insights, charts, theories, or philosophies ensure profitable investment. spread betting, trading binary options , cfd's carry high risk capital, can volatile , prices may move rapidly against you. speculate money can afford lose may lose more original deposit , required make further payments. spread betting may not suitable customers, ensure understand risks involved , seek independent advice if necessary</p> </td> </tr> </table> </body>"; $headers = "content-type: text/html\r\n"; return compact($subject, $message, $headers); } ?>
form_to_csv.php:
$to = $data['email']; require('template.php'); $mailcontent = getmailcontent(); //csv if(@$_post['land']=='fw'){ $path='/home/content/24/12131124/html/files/admin/csv_binary/'; $fname=$path.'free_workshop-'.date( "f_j_y" ).".csv"; //mail($to, $subject, $message, $headers,"-f info@opesacademy.com"); mail($to, $mailcontent['subject'], $mailcontent['message'], $mailcontent['headers'],"-f info@opesacademy.com"); }
$to
variable contains email user has inputed form.....
your mail method not return thing. please add compact('headers', 'message', 'subject');
then use returned array in other function.
<?php // might place following method mail.php // formerly mail function, renamed avoid function name clash // php's own function mail function getmailcontent(){ $subject = "opes academy- workshop confirmation"; $message = "message"; $headers = "content-type: text/html\r\n"; // return things :) return compact('subject', 'message', 'headers'); } // usage: // from_to_csv.php // need include file mail.php, // if want access function getmailcontent() // uncomment line, if split php code files. // include 'mail.php'; // fetch mail content array $mailcontent = getmailcontent(); // access array values mail($to, $mailcontent['subject'], $mailcontent['message'], $mailcontent['headers'], "-f info@opesacademy.com" ); ?>
Comments
Post a Comment