email - Mail function in PHP -
i'm using php sending e-mail. values in e-mail depending on inputs of form. reason, mail not sending. did before. what's wrong code?
orders placed correctly in database, no error there.
if ($order->addorder($_db)) { $user = "safetycam.be"; $verzonden = false; $firstname = $_post['firstname']; $lastname = $_post['lastname']; $address = $_post['address']; $zip = $_post['zip']; $place = $_post['place']; $country = $_post['country']; $phone = $_post['phone']; $email = $_post['email']; $twogig = $_post['vn_qty']; $fourgig = $_post['ja_qty']; $total = $_post['total']; $totaal = (($twogig * 50) + ($fourgig *80) + 2.5); $headers = 'from: info@something.be'; $to = 'me@gmail.com'; $subject = 'bevestiging bestelling'; $message = 'hello $firstname, placed following order on our website. - $twogig x 2gb safetycams ordered - $fourgig x 4gb safetycams ordered + shippingcosts (2,5 eur) total cost order amounts $totaal eur. products delivered possible after receipt of payment. please transfer order amount of $totaal eur account x. after payment, products sent following address: $firstname $lastname $address $zip $place $country hope happy purchase. sincerely yours"; if (mail($to, $subject, $message, $headers)) { $verzonden = true; $feedback = '<div class="feedbackheader">thanks</div><br / >'; } else { $verzonden = false; $feedback = '<div class="feedbackheader">error!</div>'; } } else { $feedback = '<div class="feedbackheader">error!</div>'; } }
i use swiftmailer:
require_once('../lib/swiftmailer/lib/swift_required.php'); function sendemail(){ //sendmail $transport = swift_sendmailtransport::newinstance('/usr/sbin/sendmail -bs'); //create mailer using created transport $mailer = swift_mailer::newinstance($transport); $body="dear $fname,\n\nyour job application successful. \n\nyours,\n\neamorr\n\n\n\n\n\n\n"; //create message $message = swift_message::newinstance('subject goes here') ->setfrom(array($email => "no-reply@yourdomain.com")) ->setto(array($email => "$fname $lname")) ->setbody($body); //send message $result = $mailer->send($message); }
Comments
Post a Comment