{"id":3305,"date":"2014-03-21T20:25:17","date_gmt":"2014-03-21T20:25:17","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/21\/problem-about-phpmailer-collection-of-common-programming-errors\/"},"modified":"2014-03-21T20:25:17","modified_gmt":"2014-03-21T20:25:17","slug":"problem-about-phpmailer-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/21\/problem-about-phpmailer-collection-of-common-programming-errors\/","title":{"rendered":"problem about phpmailer-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/WhSyn.jpg?s=32&amp;g=1\" \/><br \/>\nKatie<br \/>\nforms phpmailer comments<br \/>\nI have a site that is hosted on inmotion hosting and requires a phpMailer in order to send an email form (such as a contact form) from a site. I&#8217;ve put the necessary files and code on the contact page, but I am getting a parse error once I hit submit. Here&#8217;s the error message:Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or &#8216;}&#8217; in \/home\/username\/public_html\/phpmailer\/class.phpmailer.php on line 53Line 53 according to DreamWeaver is public $Prio<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/241b7939150146969d15d7d48fc0bb3d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDarsshan Nair<br \/>\nphp html html-email phpmailer swiftmailer<br \/>\n$transport = Swift_SmtpTransport::newInstance(&#8216;smtp.gmail.com&#8217;, 465, &#8220;ssl&#8221;)-&gt;setUsername(&#8216;username&#8217;)-&gt;setPassword(&#8216;password&#8217;);$username = $_SESSION[&#8216;username&#8217;]; $from = $_POST[&#8216;from&#8217;];$to = $_POST[&#8216;to&#8217;];$subject = $_POST[&#8216;subject&#8217;];$body = $_POST[&#8216;message&#8217;];$message = Swift_Message::newInstance($subject)-&gt;setFrom(array($from =&gt; $username)) -&gt;setTo(array($to)) -&gt;setBody($body);$mailer = Swift_Mailer::newInstance($transport); $result = $mailer-&gt;send($message);Error on Webpag<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ba84eb0a0e332197163f4e431d84144a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJason George<br \/>\nphp try-catch phpmailer<br \/>\nI have a mailer script that is looping, processing outgoing emails from my server. Occasionally it hangs up with the following error.PHP Fatal error: Uncaught exception &#8216;phpmailerException&#8217; with message &#8216;SMTP Error: Data not accepted.&#8217;This causes my script to die before the reminder of the messages can complete.Here is the code that kicks off the email.$message = new \\PHPMailer(true); $message -&gt; IsSMTP(); try {$message -&gt; SMTPAuth = true;$message -&gt; Host = Config::HOST;$message -&gt; Port = Conf<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f8f3db32ac21fcbc85c5464079a87c2b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmatino<br \/>\nphp email phpmailer<br \/>\nI&#8217;m trying to create a contact form using phpMailer and I get in firebug this: NetworkError: 500 Internal Server Error &#8211; path\/process.php uncaught exception: [object Object]each time I&#8217;m trying to run the code below. Please note that the error is not shown anymore if I remove $mail-&gt;AddAddress line, that&#8217;s why I suspect this line to be the cause. Instead a new error is displayed: You must provide at least one recipient email address when I remove it.&lt;?php $name = $_POST[&#8216;firstName&#8217;]; $ema<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b6116ac3c4b5835c6745570ea73a85c1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nCharles<br \/>\nphp phpmailer<br \/>\nI am getting the error Fatal error: Uncaught exception &#8216;phpmailerException&#8217; with message &#8216;Invalid address: &#8216; etc. etc. etc. and it is a real eye sore on the page.So I want to capture the error or suppress it or something &#8211; and then have it be returned to the form so the user can be told there is an error and to re-input their email address. All this will be neat and tidy and not the mess of an error it is now.Does anyone know how to do this?Thanks<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7e2ec587a7079672873f3410692a4f8e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlfabravo<br \/>\nphp phpmailer<br \/>\nIm new to classes and im trying to create a static email class that uses the phpmailer class.What I&#8217;d like to do is something like&#8230;Email::send(&#8216;from&#8217;, &#8216;to&#8217;, &#8216;subject&#8217;, &#8216;html message&#8217;); \/\/ worksbut if i want to add an attachment&#8230;Email::send(&#8216;from&#8217;, &#8216;to&#8217;, &#8216;subject&#8217;, &#8216;html message&#8217;)-&gt;attach(&#8216;file\/blah.txt&#8217;);This throws a fatal error: Call to undefined method PHPMailer::attach(), I understand why, I just don&#8217;t know how to go about it making the Email class do the above code, if it&#8217;s even poss<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6510cbcead4d65156069f2f8f9452680?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJonah Katz<br \/>\nphp phpmailer email-attachments<br \/>\nIve been working on create a file upload form using PHPmailer to send as attachments. Ive finally got it to send the email, but its not sending the attachment. Here&#8217;s my HTML form:&lt;input type=&#8221;file&#8221; class=&#8221;fileupload&#8221; name=&#8221;images[]&#8221; size=&#8221;80&#8243; \/&gt;And here&#8217;s my php processor code:&lt;?php require(&#8220;css\/class.phpmailer.php&#8221;); \/\/Variables Declaration $name = &#8220;the Submitter&#8221;; $email_subject = &#8220;Images Attachment&#8221;; $Email_msg =&#8221;A visitor submitted the following :\\n&#8221;; $Email_to = &#8220;jonahkatz@yahoo.c<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ca2f7d5d2e329671cf8e05d7fcdb51c5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nhooligan<br \/>\nphp phpmailer<br \/>\nI&#8217;ve just updated a contact form to use PHPMailer to stop emails being marked as junk, with no luck. It&#8217;s a fairly straight forward setup I&#8217;m using but its still going into peoples junk mail.Here is my script, I was wondering if anyone could tell what was wrong?include_once(&#8216;..\/inc\/phpmailer\/class.phpmailer.php&#8217;);$mail = new PHPMailer();$name = $_POST[&#8216;name&#8217;]; $email = $_POST[&#8217;email&#8217;]; $body = &#8220;Name: &#8220;.$name.&#8221;\\r\\n&#8221;; $body .= &#8220;Email: &#8220;.$email.&#8221;\\r\\n&#8221;; $body .= &#8220;Message: &#8220;.$_POST[&#8216;message&#8217;];$mail-&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6510cbcead4d65156069f2f8f9452680?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJonah Katz<br \/>\nphp file file-upload phpmailer<br \/>\nI have an HTML \/ javascript form written with a loop to upload an unlimited amount of files with names=&#8221;file1&#8243;,&#8221;file2&#8243;,etc. (i++)So now i have a PHP form to process it (get all files, save to temporary folder &#8220;uploads&#8221;, and email as attachments using phpmailer). &lt;?php require(&#8220;class.phpmailer.php&#8221;); \/\/Variables Declaration $name = &#8220;the Submitter&#8221;; $email_subject = &#8220;Images Attachment&#8221;; $Email_msg =&#8221;A visitor submitted the following :\\n&#8221;; $Email_to = &#8220;you@yourSite.com&#8221;; \/\/ the one that recieves<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/884e48ac8045ffd8873a46a15fb97c3e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGatura<br \/>\nphp phpmailer<br \/>\nam getting these errors while running php mailer. What could be the problemMAMP\/htdocs\/practice\/email\/email.php on line 2 [06-Jun-2011 09:53:40] PHP Notice: Undefined variable: from in \/Applications\/MAMP\/htdocs\/practice\/phpmailer\/phpmailer.inc.php on line 259 [06-Jun-2011 09:53:40] PHP Notice: Undefined variable: Encoding in \/Applications\/MAMP\/htdocs\/practice\/phpmailer\/phpmailer.inc.php on line 271 [06-Jun-2011 09:53:40] PHP Fatal error: Cannot access empty property in \/Applications\/MAMP\/<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8b3e1d5d575531978e4b080044cc3c57?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNatasha<br \/>\nphp phpmailer<br \/>\nI&#8217;m trying to send an e-mail to multiple e-mail address in my database. Here is my current code.I need to have them query my database and send the e-mail to each e-mail address.It is working but email was send to the first e-mail address only, and got an error &#8220;Fatal error: Call to undefined method stdClass::AddAddress()&#8221;.Where am I going wrong here?&lt;?php $elist = $database-&gt;getRows(&#8220;SELECT * FROM `emails`&#8221;);foreach($elist as $emails){$frm = &#8216;test@gmail.com&#8217;;$sub = &#8216;Weekly Work Report&#8217;;ob<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/dd53052f52eabc114751609fc2b40174?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ndotty<br \/>\nphp email phpmailer<br \/>\nHay I&#8217;m using PHPMailer to send some simple emails, however the function SetFrom() doesn&#8217;t seem to work, even though the code I&#8217;m using is straight from phpmails docs (http:\/\/phpmailer.worxware.com\/index.php?pg=examplebmail)Here my errorCall to undefined method PHPMailer::SetFrom()and my scriptrequire_once(&#8216;inc\/phpmailer\/class.phpmailer.php&#8217;); $mail = new PHPMailer(); \/\/ defaults to using php &#8220;mail()&#8221; $body = $message; $mail-&gt;SetFrom(&#8216;tell-a-friend@domain.com&#8217;, &#8216;tell a friend&#8217;); $mail-&gt;Add<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5c00ca3528a4fdbd270f143452e38cd6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1154295<br \/>\nphp forms jquery-ajax phpmailer undefined-index<br \/>\nI take a form and do variable checking in jquery then pass it to a php file in ajax but I am getting this noticeNotice: Undefined index: your_name in C:\\xampp\\htdocs\\process.php on line 3 something is wrong here Notice: Undefined index: your_email in C:\\xampp\\htdocs\\process.php on line 7Here is my jquery code here$(&#8220;.button&#8221;).click(function(){$(&#8216;.error&#8217;).hide(); var your_email=$(&#8220;input#your_email&#8221;).val(); if(your_email ==&#8221;&#8221;){$(&#8220;label#youremail_error&#8221;).show(); $(&#8220;input#your_email&#8221;).focus(); retu<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a2b808707be6cd97fe0807e8f778249c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1785934<br \/>\nemail gmail phpmailer<br \/>\nI have a website set up using class.phpmailer.php gmail and smtp when the form is submitted it goes to the gmail account were it is then forwarded to the correct people based on the subject and content.Im trying to make it when our agents hits the reply button there name and email shows up and not the email it was sent from. I can get the name to work but not there email address. so if a guy fills it out, his name is test his email is test@test.com this is what I want to show up when we hits the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a214bcecbc04c7c42696e55cbdea3e17?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAziz<br \/>\nemail phpmailer hotmail mailserver<br \/>\nMy server send activation mails at signup process.Hotmail doesn&#8217;t accept mails from server. There&#8217;s no mail as well in junk folder.What could I do? What I have to?Thanks<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d5f91983a9d9cfb69981b6108a63b412?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nskaffman<br \/>\nphp phpmailer<br \/>\nPossible Duplicate:PHPMailer AddAddress() Here is my code.require(&#8216;class.phpmailer.php&#8217;); $mail = new PHPMailer();$email = &#8217;email1@test.com, email2@test.com, email3@test.com&#8217;;$sendmail = &#8220;$email&#8221;;$mail-&gt;AddAddress($sendmail,&#8221;Subject&#8221;);$mail-&gt;Subject = &#8220;Subject&#8221;; $mail-&gt;Body = $content; if(!$mail-&gt;Send()) { # sending mail failed$msg=&#8221;Unknown Error has Occured. Please try again Later.&#8221;;}else {$msg=&#8221;Your Message has been sent. We&#8217;ll keep in touch with you soon.&#8221;;} }The Problem if $email<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e9a534c767e52e8d8348b6a16e3abb93?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\n2 revschupinette<br \/>\nphp attachment sendmail phpmailer<br \/>\nI am using phpmailer class to send email and i am attaching a file to the mail. The email is sent successfully but the attachment which is an sql file is empty which should not be the case. I have tried with an image file, but it seems that every file that i attach is empty. Can anyone help me solve this problem please?$mail = new PHPMailer();$body = &#8220;Reminder&#8221;;$mail-&gt;IsSMTP(); $mail-&gt;Host = &#8220;mail.yourdomain.com&#8221;; $mail-&gt;SMTPDebug = 1; $mail-&gt;SMTPAuth = true; $mail-&gt;SMTP<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2f45223153d2ae1ee9f3c6c6ec180f25?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkamushin<br \/>\nphp phpmailer<br \/>\nI use my own smtp host.When PHPMailer return this &#8216;The following From address failed&#8217; error; I execute the command below without success:tshark -i eth0 -R &#8220;tcp.dstport == 25&#8243;PHPMailer havn&#8217;t send anything to my host? Where is wrong?After I user IP replace the MX record,I get this new error SMTP Error: The following recipients failed: example@qq.comSMTP server error: 5.7.1 &lt;example@qq.com&gt;: Relay access deniedconnect from unknown[1.2.3.4] NOQUEUE: reject: RCPT from unknown[1.2.3.4]: 554<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/02kYp.jpg?s=32&amp;g=1\" \/><br \/>\nZhangCC<br \/>\nphp smtp phpmailer postfix<br \/>\nI&#8217;ve set up a Postfix mail server, and I can send and receive using a local mail client successfully.Now, I wanna send mail using PHPMailer via this mail server, but it failed:SMTP -&gt; ERROR: Failed to connect to server: (0) SMTP Connect() failed. Mailer Error: SMTP Connect() failed.The mail server is authenticated using SSLAnd here is the log of mail server:May 23 10:07:14 zhangcc postfix\/smtpd[7980]: disconnect from unknown[1xx.xxx.xx.xxx] May 23 10:07:16 zhangcc postfix\/smtpd[7980]: connect<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/MGhY2.png?s=32&amp;g=1\" \/><br \/>\nhakre<br \/>\nphp phpmailer<br \/>\nI&#8217;m Using PHPMailer in a Simple Script For Send Email&#8217;s Through Gmail, And I&#8217;m Getting an &#8220;Unknown Error&#8221; (At least For me!):SMTP Error: Could not authenticate.Error: SMTP Error: Could notauthenticate.SMTP server error: 5.7.1 Username andPassword not accepted. Learn more at535 5.7.1http:\/\/mail.google.com\/support\/bin\/answer.py?answer=14257p38sm2467302ybk.16I&#8217;ve Read About Configure OpenSSL For SSL\/TLS Connections, and i did it. Apache And PHP Are properly-Configured (With OpenSSL extension Runnin<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Katie forms phpmailer comments I have a site that is hosted on inmotion hosting and requires a phpMailer in order to send an email form (such as a contact form) from a site. I&#8217;ve put the necessary files and code on the contact page, but I am getting a parse error once I hit submit. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3305","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3305"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3305\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}