Jump to content

Peg

Members
  • Posts

    20
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Peg's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank You!!! Yes, I will update to a newer version. mac_gyver Thank you for a great temporary solution to my problem, and for the clarity of how you explained it!
  2. Good point, but I am not ready to update to php 7 yet. The site still uses MySQL functions and I do not have the go ahead to spend the time (and charge them) for changing it. So I actually need to find a version of PHPMailer that will work with php 5.2.17 At least until they are ready to spend the money to pay for me to update their site.
  3. 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.
  4. Thank You bsmither. That is a good idea, but it is not what is happening here. I'm sure of it for a couple of reasons. First I have been using the same list for over a year, the emails were being sent using the php mail() function. This never produced duplicates. Second the people in this organization that I am in contact with are in a field that requires clerical precision. I'm sure they would know if this were happening. Truly they are very organized. Thank You gizmola I looked it up in my hosting account it says that my SMTP server name is dedrelay.secureserver.net. I have a meeting I have to go to. I will read over the documentation you gave me a link to this afternoon.
  5. Yes, I am using a server on GoDaddy. The server that is sending the email is a Virtual Dedicated Server hosted with GoDaddy. I think that it is different than having shared hosting with GoDaddy, because, to the best of my knoweledge, I ham not using GoDaddy's mail server. I really do not know much about servers and there are alot of settings in the c-panel for the server that I just do not understand. In my gut I feel like the problem is a cashing issue. I have tried multiple tests that send to my 3 emails and have not been able to recreate the problem. My client was a bit upset about the multiple emails going out to some of the members so I have been a bit reluctant to ask him if I can run another test so that I can log the messages to a file, but I think I have no other choice. Thanks for all of your help. Thanks also for telling me that GoDaddy has confusing issues associated with their mail server infrastructure and delivery or lack-thereof. This will help me out with another issue I am having with another site.
  6. Are you sure there aren't multiple entries in the database for the same email?Yes, I am sure there are not multiple emails. I tweeked the code to echo the emails so I could read the list of emails. So, I am sure this is not the cause of the problem. Are you logging the messages to a file? What does the file indicate? For these dupes?No, I am not logging the messages to a file. I can set that up and see what is said there Are you sure the cron job setup is correct?Yes, I am very positive the cron job is set up correctly. I has been running for over a year using the php mail() function. This never produced a duplicate email. The problem with the php mail() function is that some of the members of this organization were not getting an email because of the security settings in their email client. Did you check the logs for the MTA that is actually sending the emails?Not sure what you mean by this. Could be an issue with the query to fetch the pending mails (which we don't know),The query has been tested and checked. The problem is not the query. I would give you the code for the query but it is complicated and I have tested it alot of times. I have I have run the code and instead of sending the email, I echoed out the values of $organizationemails array. So, I am sure that there is not a problem with that end of the code could be an issue with your server configuration (which we don't know).This seems the most likely to be the problem. The server is a GoDaddy Virtual Dedicated Server, Plesk Paralles Panel. Make sure you got an up-to-date version of PHPMailer (5.2.7). Then run the script a couple of times and send yourself some emails to see if you can reproduce the problem. If you can, var_dump() will help you analyze the exact conditions.I have been using 5.2.4. I will update to a the newest version. I did run a lot of tests on the script. I have tested the script by sending it out to 3 of my email address. (Editing the query to querry a different table in the database. That only has my email address in it.) I have not been able to duplicate the problem when I am only sending to my three email address's. The problem has only occurred when I send out to the actual list that is about 180 emails.
  7. I am using PHP Mailer to send out emails to an array of email address. So I am looping through the array of emails and then sending out the emails individually. The script works except it is sending out more than one email to some of the email address. Today my client told me that he got 2 more emails on Sunday just like the 2 he got on Thursday. I am assuming that this has something to do with caching, but I do not know. The trigger that sends out the emails is part of a cron job. The cronjob runs every 30 minutes. Checks to see if there is a new entry in one of the tables in the database. Then it sends out the email to all of the members. After the email is sent a value is changed for that entry in the data base. I am explaining this only to help you to see that the problem is not that the code is being triggered again. If that was the problem then there would be and email every 30 minutes and that is not what happened. Here is the code: <?php require_once('library/PHPMailer/class.phpmailer.php'); require_once('library/PHPMailer/class.smtp.php'); foreach($organizationemails as $key => $value){ $contents = '<body> <div> <p> ...content of email ... </p> </div> </body>'; error_reporting(E_ALL); error_reporting(E_STRICT); $mail = new PHPMailer(); $body = $contents; $body = preg_replace('/[\]/','',$body); $mail->IsSMTP(); $mail->Host = "ssl://smtp.mysite.org"; $mail->SMTPAuth = true; $mail->Port = 465; $mail->Username = "sendingmail@mysite.org"; $mail->Password = "password"; $mail->SetFrom('info@mysite.org', 'My Organization'); $mail->AddReplyTo('info@mysite.org', 'My Organization'); $mail->Subject = 'My Email Title'; $mail->AltBody = '... has been posted...'; $mail->MsgHTML($contents); $address = $value; $mail->AddAddress($address); if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; }else{ echo "Message has been sent to ".$value; } } ?>
  8. OK. Thank you for being so quick to reply to my comment, and for explaining things to me in a way that I can understand them! I will contact their tech and see if there is a place on the server that I can move a file to. He told me earlier that WordPress was not allowed to upload anything to the server, because he had restrictions on the server that did not allow files to be uploaded to the server. So I believe that moving the file/csv is not going to be allowed, but I will try to get more information. Thank You!
  9. The error that is generated by the new code is: "Problem #2". So this means that the file exists but is not allowed to open. So, mac_gyver, this most likely means that either safe mode or open_basedir in enabled. your suggestion is to use move_uploaded_file() to read/move the temp uploaded file to a file that php can access without restrictions. I guess I'm confused on why it would make a difference where the file is? Wouldn't server restrictions apply to any place on the server? Sorry to keep asking you questions. I honestly would try some things before I ask questions, but I don't have the option of using ftp. So I just want to be sure that I don't ask their tech to upload documents more often that I have to. Thanks Again!!!
  10. Here is the new code that I am sending to the tech. It will probably take a couple of days before this gets uploaded to the server. Thank You all for all of your help!! <?php $csvfile = $_FILES['userfile']['tmp_name']; $size = $_FILES['userfile']['size']; if($_POST['upload_csv']){ //----------------------------------------------------------------------other validation code here. if($problem){ echo '<div class="error">'.$error_message.'</div>'; include("form_upload_csv.inc.php"); }else{ if (($handle = fopen($csvfile, "r")) !== FALSE) { echo '<div class="message"><p>CSV has been opened!</p></div>'; }elseif(!$csvfile){ echo '<div class="error">Problem #1</div>'; }else{ if ($_FILES['userfile']['error'] != UPLOAD_ERR_OK){ //report an upload error somehow echo '<div class="error">Failed to upload file, error code is: '.$_FILES['userfile']['error'].'</div>'; $problem = true; }else{ echo '<div class="error">Problem #2</div>'; } } } }else{ include("form_upload_csv.inc.php"); } ?>
  11. Thank You Kicken. I will add that to the validation and send the updated code to their tech guy to ftp up for me. In asnswer to you mac_gyver a) Yes this is a continuation of my other thread. If you would merge them that would be great. Thank You! b) I did just read his comment and answer it. It is not hosted with GoDaddy. If it were I would at least have ftp access into the server. That would be really nice. c) I will put the code that Kicken gave me into my script d) Actually I did change the name ... but like you said it is not relevant e) This make sense to me. Thank you for explaining in a way that could understand! I will probably need your guidance to read/move the temp uploaded file to a file that php can access without restrictions. Give me a minute and I will post the code that I am going to send to my clients tech.
  12. Thank you Ken. No the Windows server is not with GoDaddy. The server is "on site" in my clients building. That is actually all I know, besides the fact that there is protected information on the server.
  13. Honestly I am confused! Are you telling me that I can upload the class that is on this page: http://www.php.net/manual/en/features.file-upload.errors.php and then this class will output an error to the page where the class exists? Or is the class going to output the error to the error logs. I do not have access to the error logs. Understand that I do not have ftp access to the site. So it is a few day process to get anything uploaded to their site. When I put the class on my test site I got this error: Fatal error: Uncaught exception 'UploadException' with message 'Unknown upload error' in /home/content/38/3399238/html/mysite/mypage.php:54 Stack trace: #0 {main} thrown in /home/content/38/3399238/html/mysite/mypage.php on line 54
  14. ...I will look at this on Monday...not sure that I understand it. I do know that I do not have access to the server, and I never will. So changing any settings or restarting the server is not going to happen. But I will look over the documentation on the link and try to figure out how to use it. I tried to put the class/code on the test site that I originally built the functionality on and all I got was an error. I am new to OOP...really new. Don't I have to have a class called "Exception" so that I can post the class UploadException as an extension of "Exception"
  15. I set up functionality for a client that got moved to their server after I wrote and tested the functionality. It does not work on their server and I am trying to trouble shoot the problem as I do not have ftp access to the server. I believe that I have narrowed it down to either I do not know how to access the temp files on their server, Windows IIS, OR the security on the server is not allowing me to upload to the temp files. Here is the form used to upload to the server. <form enctype="multipart/form-data" action="#" method="post" > <input type="hidden" name="upload_csv" value="TRUE" /> <p><label for="userfile">Upload CSV:</label> <input type="hidden" name="MAX_FILE_SIZE" value="45000000" /> <input type="file" id="userfile" name="userfile" title="userfile" value="" /></p> <p><input type="submit" name="upload_csv" value="Upload CSV" /></p> </form> Here is the test code: <?php $csvfile = $_FILES['userfile']['tmp_name']; $size = $_FILES['userfile']['size']; if($_POST['upload_csv']){ //---------------------------------validation code here if($problem){ echo '<div class="error">Did not pass validation</div>'; include("upload_csv.inc.php"); }else{ if (($handle = fopen($csvfile, "r")) !== FALSE) { //--------------------------------------------------------------this is where the code that imports the data from the csv and to the database goes echo '<div class="message"><p>CSV has been opened!</p></div>'; }elseif(!$csvfile){ echo '<div class="error">Problem #1</div>'; }else{ echo '<div class="error">Problem #2</div>'; } } }else{ include("upload_csv.inc.php"); } ?> This code generated the error message: Problem #2. One more bit of information: the permissions on the server is set so that nothing can be uploaded by an external script. I do not know much about servers, but it seems to me that because the security is so tight on the server, the security is the reason that this does not work...??? I appreciate help with this. I just am not knowledgeable on how the $_FILES['userfile']['tmp_name'] code actually works?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.