Jump to content

Search the Community

Showing results for tags 'phpmailer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 5 results

  1. I downloaded a piece of software from github but I can not really get it working, so I would like to get some tips of people who have used this. The name of the script is PHPMailer. I have the latest version. I decided to use gmail for smtp. with autentication. In the troubleshooting they recommended to use composer, but I dont get what / why they want it. What is composer used for? As far as i get it is used to run php commands from a command line. This my script: <?php // Import PHPMailer classes into the global namespace // These must be at the top of your script, not inside a function use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; //Load composer's autoloader //require 'vendor/autoload.php'; require 'A:\wamp64\www\PHPMailer\src\Exception.php'; require 'A:\wamp64\www\PHPMailer\src\PHPMailer.php'; require 'A:\wamp64\www\PHPMailer\src\SMTP.php'; $mail = new PHPMailer(true); // Passing `true` enables exceptions try { //Server settings $mail->SMTPDebug = 4; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'my.own.gmail@gmail.com'; // SMTP username $mail->Password = '12345fake'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to //Recipients $mail->setFrom('my.own.gmail@gmail.com', 'My Own Gmail'); $mail->addAddress('recipient.person999@gmail.com', 'John Doe'); // Add a recipient // $mail->addAddress('ellen@example.com'); // Name is optional // $mail->addReplyTo('info@example.com', 'Information'); // $mail->addCC('cc@example.com'); // $mail->addBCC('bcc@example.com'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'To John Doe (test mail) '; $mail->Body = 'This is the HTML message body <b>in bold!</b>'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } ?> when running the script I dont receive an email and I get the following output with a message: 2018-01-05 13:21:25 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [A:\wamp64\www\PHPMailer\src\SMTP.php line 404] SMTP Error: Could not connect to SMTP host. 2018-01-05 13:21:25 CLIENT -> SERVER: QUIT see the complete output here: I'm curious what causes this error and would like to solve it.
  2. Hi, I'm using PHPMailer to send email from a contact form using gmail SMTP which requires to include the SMTP password directly in the PHP script like so $mail->Password = 'mypassword'; According to what I've found on the net, it seems that it's not recommended since the password can be easily hacked. Thus, I'm wondering how to do to protect my password. I've found people recommending to put the password in an INI file outside the webroot and then to retrieve it using parse_ini_file() function. My problem is that I'm not sure I understand the "outside the webroot" part… if anyone could explain this to me and how to do it, it would be much appreciated. Also, should I protect the INI file with a .htaccess? Thanks.
  3. BACKGROUND: I am setting up an email verification routine that receives $_POST data from a form and sends a confirmation email to the applicant with a verification link. The form and the PHP processing routines that store the $_POST data in a MySQL database, and that send out the confirmation email in text format are contained in the same document. The HTML formatted confirmation email is contained in an external file and is included using the following PHP-Mailer method: $mail->msgHTML(file_get_contents('../../confirmation_mail.html'), dirname(__FILE__)); GOAL: Include in the external HTML file information obtained from the $_POST variable before the email is sent. WHAT DOES NOT APPEAR TO WORK: I have tried placing statements similar to <?php echo "blah, blah, blah" . $variable_name . "blah, blah, blah"; ?> in the external file in the hope that the value of $variable_name would be read into the file before it is sent. Unfortunately, this does not work. ANY SUGGESTIONS?
  4. Hello, I have a problem involving Phpmailer and a While loop. Actually I have always had problems to sending emails this way. Now for instance I can send e-mails trough an IF (instead of While) and the following script works fine. But as soon as I change it into While it doesn't. Even the last part of the script (UPDATE) doesn't work (it worked upon IF). I am trying with just two e-mails to be sent and only the first one is sent.I would be so happy to solve this issue. While loop is really important when it comes to sending e-mails. This is my script: ...include('conexioninclude.php');mysql_set_charset('utf8');$registros=mysql_query("SELECT mail, name, password, codigo FROM alert WHERE status='on' AND language1='$language2' AND language2='$language1' AND way LIKE '%$way%' ORDER BY codigo",$conexion)ordie("Problems at selectt:".mysql_error());require("class.phpmailer.php");$mail = new PHPMailer();while($reg=mysql_fetch_array($registros)){$mailu=$reg['mail'];$namee=$reg['name'];$password=$reg['password'];$codigo=$reg['codigo'];$mail->IsSMTP();$mail->Port = 465;$mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true;$mail->Username = "xxxxx";$mail->Password = "xxxxxx"; // SMTP password$webmaster_email = "xxxxxx"; //Reply to this email ID$email="xxxxx"; // Recipients email ID$name="Admin"; // Recipient's name$mail->From = "xxxxxx";$mail->FromName = "Sharinglanguage.com";$mail->AddAddress($mailu,$namee);$mail->AddReplyTo(xxxxxx,"Webmaster");$mail->WordWrap = 50; // set word wrap$mail->SetLanguage("en","/php/language/");$mail->AddAttachment("/var/tmp/file.tar.gz");$mail->AddAttachment("/tmp/image.jpg", "phone.jpg");$mail->AddAttachment("image.jpg", "phone.jpg"); $mail->IsHTML(true); // send as HTML$mail->Subject = "xxxxxxxxx";$foto= "imagess/bonito.jpg";$mensaje='<font-color="#559999"><img src="'. $foto .'" width="600"><br /><br />Hello '.$namee.',<br /><br />xxxxxxxxxxxxxxxx .<br /><br />Sincerely yours</font>'; $mail->MsgHTML($mensaje);if(!$mail->Send()){print<<<HEREmessage wasn't sent;HERE;}else{$registros2=mysql_query("SELECT yep FROM vamos WHERE password='$password'",$conexion)ordie("Problems at selectt:".mysql_error());if($reg=mysql_fetch_array($registros)){$yep=$reg['yep']; // it's an Int type field (numbers)$saw=$yep+1;$registros3=mysql_query("UPDATE vamosSET yep='$saw'WHERE password='$password'",$conexion)ordie("Proble8uhims with selectttt:".mysql_error());}print<<<HEREsuccess!;HERE;}... Thank you very much in advance for any help. Regards
  5. please help I know it's something silly , i cannot get the selecter checkboxes to send to the mail index.php <?phpsession_name("fancyform");session_start();$_SESSION['n1'] = rand(1,20);$_SESSION['n2'] = rand(1,20);$_SESSION['expect'] = $_SESSION['n1']+$_SESSION['n2'];$str='';if($_SESSION['errStr']){ $str='<div class="error">'.$_SESSION['errStr'].'</div>'; unset($_SESSION['errStr']);}$success='';if($_SESSION['sent']){ $success='<h1>Thank you!</h1>'; $css='<style type="text/css">#contact-form{display:none;}</style>'; unset($_SESSION['sent']);}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Henster Feedback Form </title><link rel="stylesheet" type="text/css" href="jqtransformplugin/jqtransform.css" /><link rel="stylesheet" type="text/css" href="formValidator/validationEngine.jquery.css" /><link rel="stylesheet" type="text/css" href="demo.css" /><?=$css?><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script><script type="text/javascript" src="jqtransformplugin/jquery.jqtransform.js"></script><script type="text/javascript" src="formValidator/jquery.validationEngine.js"></script><script type="text/javascript" src="script.js"></script></head><body><div id="main-container"> <div id="form-container"> <h1>Hensters Feedback Form</h1><br><br> <h2>Drop us a line and we will get back to you</h2> <form id="contact-form" name="contact-form" method="post" action="submit.php"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td width="15%"><label for="name"><Name</label></td> <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td> <td width="15%" id="errOffset"> </td> </tr> <tr> <td><label for="email">Email</label></td> <td><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td> <td> </td> </tr> <tr> <td><label for="subject">Subject</label></td> <td><select name="subject" id="subject"> <option value="" selected="selected"> - Choose -</option> <option value="Question">Question</option> <option value="Business proposal">Business proposal</option> <option value="Advertisement">Advertising</option> <option value="Complaint">Complaint</option> </select> </td> <td> </td> </tr> <tr> <td valign="top"><label for="message">Message</label></td> <td><textarea name="message" id="message" class="validate[required]" cols="35" rows="5"><?=$_SESSION['post']['message']?></textarea></td> <td valign="top"> </td> </tr> <tr> <td><label for="series">series</label></td> <td><input type="checkbox" name="series" id="series" value="series ” /><?=$_SESSION['post']['value']?> </td> <td valign="top"> </td> <tr> <td> <label FOR="blue">blue</label></td> <td> <input type="checkbox" name="check[]" value="blue"><?=$_SESSION['post']['value']?></td></tr><br> <h2>Select the Series </h2> <tr> <td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td> <td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td> <td valign="top"> </td> </tr> <tr> <td valign="top"> </td> <td colspan="2"><input type="submit" name="button" id="button" value="Submit" /> <input type="reset" name="button2" id="button2" value="Reset" /> </tr> <?=$str?> <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td> </tr> </table> </form> <?=$success?> </div> <div class="tutorial-info"> This is a Henster Feedback Page</div></body></html> and my submit.php ?php/* config start */$emailAddress = 'info@henster.co.za';/* config end */require "phpmailer/class.phpmailer.php";session_name("fancyform");session_start();foreach($_POST['check'] as $value) {$check_msg .= "Checked: $value\n";}foreach($_POST as $k=>$v){ if(ini_get('magic_quotes_gpc')) $_POST[$k]=stripslashes($_POST[$k]); $_POST[$k]=htmlspecialchars(strip_tags($_POST[$k]));}$err = array();if(!checkLen('name')) $err[]='The name field is too short or empty!';if(!checkLen('email')) $err[]='The email field is too short or empty!';else if(!checkEmail($_POST['email'])) $err[]='Your email is not valid!';if(!checkLen('subject')) $err[]='You have not selected a subject!';if(!checkLen('message')) $err[]='The message field is too short or empty!';if((int)$_POST['captcha'] != $_SESSION['expect']) $err[]='The captcha code is wrong!';if(count($err)){ if($_POST['ajax']) { echo '-1'; } else if($_SERVER['HTTP_REFERER']) { $_SESSION['errStr'] = implode('<br />',$err); $_SESSION['post']=$_POST; header('Location: '.$_SERVER['HTTP_REFERER']); } exit;}$msg='Name: '.$_POST['name'].'<br />Email: '.$_POST['email'].'<br />IP: '.$_SERVER['REMOTE_ADDR'].'<br /><br />Series Selected : '.$_POST['value'].'<br />Message:<br /><br />'.nl2br($_POST['message']).'';if($_POST['consultancy']==1) { $msg.='Consultancy: '.$_POST['consultancy']; }$mail = new PHPMailer();$mail->IsMail();$mail->AddReplyTo($_POST['email'], $_POST['name']);$mail->AddAddress($emailAddress);$mail->SetFrom($_POST['email'], $_POST['name']);$mail->Subject = "A new ".mb_strtolower($_POST['subject'])." from ".$_POST['name']." | contact form feedback";$mail->MsgHTML($msg);$mail->Send();unset($_SESSION['post']);if($_POST['ajax']){ echo '1';}else{ $_SESSION['sent']=1; if($_SERVER['HTTP_REFERER']) header('Location: '.$_SERVER['HTTP_REFERER']); exit;}function checkLen($str,$len=2){ return isset($_POST[$str]) && mb_strlen(strip_tags($_POST[$str]),"utf-8") > $len;}function checkEmail($str){ return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str);}?>
×
×
  • Create New...