Search the Community
Showing results for tags 'phpmailer'.
-
I am just learning how to use PHPMailer. I have not touched anything on any of the PHPMailer files. I am using php 5.2.17 I am surprised to get this error: Parse error: syntax error, unexpected T_FUNCTION in /home/content/33/3333333/html/folder/folder2/PHPMailer/class.phpmailer.php on line 3042 I assumed that this would be something common and I would find another person who had the same issue. Only I do not see anyone with the same error and line as this. I could post my code, but the error comes before any of my code is run. Meaning the php file starts with: date_default_timezone_set('America/Los_Angeles'); require 'PHPMailer/PHPMailerAutoload.php'; The error is found before any of my code is run.
-
Will someone, who doesn't mind helping an old man understand some things, explain how to use PHPMailer? You see, I downloaded a registration form that sends a verification e-mail. I'm testing all of this on my local machine (Linux). The mail, of course, fails to be delivered. So I surf around and see where phpmailer can help me with this. So I downloaded phpmailer-master. But I have absoultely no idea where to put what so I'll have e-mail capability from localhost. If you can tell me what goes where, I promise to name my next child after ya I just need some guidance on this one. It has me totally confused! Landslyde PS: Happy 2015 to all!
-
I would like to send an email when % is >than 50%, if so get fields from Txt fiel and fields from DB and send an email to the address in the txt file. <html> <head><title>Email Alert</title></head> <body> <?php require 'PHPMailerAutoload.php'; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // Enable verbose debug output mysql_connect("ip","user","pass") or die(mysql_error()); //mysql_select_db("DB") or die(mysql_error()); //$sql = "SELECT * from pool"; $sql = mysql_db_query ("demo", "select * from pool "); while ($row = mysql_fetch_assoc($sql)) { $sql = "SELECT '%' FROM pool Where >= 50 "; { //echo $row->number; $percent = $row['%'] ; $pool2 = $row['pool']; $balance = $row['balance']; /////////////////////////// //data from file ////////// ////////////////////////// $file = fopen('EmailAndPool2.csv', 'r'); $fields = array(); if ($file) { while (($data = fgetcsv($file)) !== false) { if(empty($fields)) { $fields = $data; continue; } $row = array_combine($fields, $data); // Format output conveniently with sprintf $output = sprintf("%s Pool %s email.\n", $row['pool'], $row['email']); echo $output; } fclose($file); $pool1 = $row['pool']; //while ($pool2 == $pool1 and $percent > "50") $pool2 =$row['pool2']; $mail = new PHPMailer; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'xxxxxxxxx; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'xxxxxxxxxxxxxxxxx'; // SMTP username $mail->Password = 'xxxxxxxxxxxxxxxx; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->FromName = 'Support'; $mail->addAddress ($row['email']); //$mail->addAddress = $members; //$mail->addCC('xxxxxxxxxxx'); //$mail->addCC('xxxxxxxxxxxxxxxx'); $mail->WordWrap = 50; // Set word wrap to 50 characters $mail->isHTML(true); $mail->Subject = 'test'; $mail->Body = 'test '; $email_from = 'xxxxxxxxxxxx'; } if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } } } ?> </body> </html> Thank you
-
Hello, I am sending an email via phpmailer to a large group of recipients. I bcc'd the entire group which of course failed after the max limit was reached so I thought what about sending in chunks.... Im just trying to figure out how to loop through the groups of bcc's basically Im thinking something like this... $mail = new PHPMailer(true); $mail->IsSMTP(); //setup from, replyto etc here... //email query here to get emails in array $bccz.. //chunk results $newArray = array_chunk($bccz, 50, false); // Now process array_chunk() $i = 0; foreach ($newArray as $inner_array) { $i++; while (list($key, $value) = each($inner_array)) { addBCC($value['email']); }$subject = '=?UTF-8?B?'.base64_encode($cobig).'?='; $mail->Subject = $subject; $mail->IsHTML(true); $mail->Body = $ermail; $mail->Send(); } $mail->clearBcc(); } Just wondering if someone can tell me if this basic logic is right?
-
Hi guys Hoping you can help me with this. I'm very much a front end person, I know HTML, CSS and some JS but when it comes to PHP and very much a newbie. I'm using this code to process a straight forward contact form. I'm using the PHP Mailer as I need to use an external smtp server and the company I use for this provided some basic code. Its working but I'm getting a error flash up before I see the success page that says "Undefined variable: message in send.php on line 25. Why is this happening and how do I fix it? Thanks guys. my code <?php require("PHPMailerAutoload.php"); // path to the PHPMailer class. $after = "/contact/thanks.php"; $oops = "/contact/error.php"; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Mailer = "smtp"; $mail->Host = "smtpcorp.com"; $mail->Port = "2525"; $mail->SMTPAuth = true; $mail->Username = "[email protected]"; $mail->Password = "xxx"; $mail->From = "[email protected]"; $mail->FromName = "Richard Dale"; $mail->AddAddress("[email protected]", "Rachel Recipient"); $mail->AddReplyTo("[email protected]", "Sender's Name"); $mail->Subject = "Contact enquiry from the website"; $message .= "How can we help: {$_POST['help']} \n\n"; $message .= "Name: {$_POST['name']} \n\n"; $message .= "Email: {$_POST['email']} \n\n"; $message .= "Telephone: {$_POST['tel']} \n\n"; $message .= "Message: {$_POST['message']} \n\n"; $message .= "Address: {$_POST['address']} \n\n"; $mail->Body = $message; $mail->WordWrap = 50; if(!$mail->Send()) { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$oops\">"; } else { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">"; } ?>
-
I am attempting to create a php AJAX contact form , however the email never seems to arrive in my outlook. /* Jquery Validation using jqBootstrapValidation example is taken from jqBootstrapValidation docs */ $(function() { $("input,textarea").jqBootstrapValidation( { preventSubmit: true, submitError: function($form, event, errors) { // something to have when submit produces an error ? // Not decided if I need it yet }, submitSuccess: function($form, event) { event.preventDefault(); // prevent default submit behaviour // get values from FORM var name = $("input#name").val(); var email = $("input#email").val(); var phone = $("input#phone").val(); var message = $("textarea#message").val(); var firstName = name; // For Success/Failure Message // Check for white space in name for Success/Fail message if (firstName.indexOf(' ') >= 0) { firstName = name.split(' ').slice(0, -1).join(' '); } $.ajax({ url: "./bin/contact_me.php", type: "POST", data: {name: name,phone:phone, email: email, message: message}, cache: false, success: function() { // Success message $('#success').html("<div class='alert alert-success'>"); $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") .append( "</button>"); $('#success > .alert-success') .append("<strong>Your message has been sent. </strong>"); $('#success > .alert-success') .append('</div>'); //clear all fields $('#contactForm').trigger("reset"); }, error: function() { // Fail message $('#success').html("<div class='alert alert-danger'>"); $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") .append( "</button>"); $('#success > .alert-danger').append("<strong>Sorry "+firstName+" it seems that my mail server is not responding...</strong> Could you please email me directly ? Sorry for the inconvenience!"); $('#success > .alert-danger').append('</div>'); //clear all fields $('#contactForm').trigger("reset"); }, }) }, filter: function() { return $(this).is(":visible"); }, }); $("a[data-toggle=\"tab\"]").click(function(e) { e.preventDefault(); $(this).tab("show"); }); }); /*When clicking on Full hide fail/success boxes */ $('#name').focus(function() { $('#success').html(''); }); <?php require("../lib/phpmailer/PHPMailerAutoload.php"); if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; return false; } $m = new PHPMailer(); $m->IsSMTP(); $m->SMTPAuth = true; $m->SMTPDebug = 2; $m->Host = "smtp-mail.outlook.com"; $m->Username = ""; $m->Password = ""; $m->SMTPSecure = 'tls'; $m->Port = 587; $m->addAddress('[email protected]', $name); $name = $_POST['name']; $email_address = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $m->Subject = "Contact Form has been submitted"; $m->Body = "You have received a new message. <br><br>". " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>". "Email: $email_address<br> Message <br> $message"; if(!$m->Send()) { echo "Mailer Error: " . $m->ErrorInfo; exit; } ?>