Code: Select all
$swift->disconnect();Any ideas?
Moderators: Chris Corbyn, General Moderators
Code: Select all
$swift->disconnect();OK here we god11wtq wrote:Yep, more code please
Code: Select all
set_time_limit(0);
ignore_user_abort();
foreach($_POST AS $key => $value) {
${$key} = $value;
}
foreach($_GET AS $key => $value) {
${$key} = $value;
}
global $stopped, $entrydate;
$table= "sendoutlist";
$stopped = "n";
$entrydate = date("Y-m-d");
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$sql2 = "SELECT * FROM sendoutlist WHERE entrydate < '$entrydate' AND done = 'NULL' AND stopped = '$stopped' or entrydate = '$entrydate' AND done = 'NULL' AND stopped = '$stopped'";
$resultsx = mysql_query($sql2) or die("An error ocurred :".mysql_error());
while ($row = mysql_fetch_array($resultsx)) {
$myID = $row['jobid'];
$title = $row['mailSubject'];
$listname = $row['listname'];
$lastemail = $row['lastemail'];
//echo $myID;
if ($lastemail != "")
{
//check listcounter
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$sql3 = "SELECT * FROM listcounter WHERE listname = '$listname' AND jobid = '$myID'";
//echo $sql3;
$results3 = mysql_query($sql3) or die("An error ocurred :".mysql_error());
while ($row = mysql_fetch_array($results3)) {
$themail = $row['lastemail'];
$howmany = $row['howmany'];
// count of emails should not exceed 4200 per 24 hours
}
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$mailBody = "";
$table= "walter";
// For each vac line...
$sql4 = "SELECT * FROM $table WHERE jobid = '$myID'";
$results4 = mysql_query($sql4) or die("An error ocurred :".mysql_error());
while ($row = mysql_fetch_array($results4)) {
$ID = $row["jobid"];
$contact = $row["user"];
$emailadd = $row["useremail"];
$mycat = $row["cat"];
$title = $row["title"];
$salary = $row["salary"];
$location = $row["location"];
$description = $row["skills"];
$benefits = $row["benefits"];
$description=str_replace("#","/n",$description);
$mailBody =$mailBody."\n\nHere is the latest vacancy, ID number {$ID} \n\n Job Title: {$title} \n\n Salary: {$salary} Benefits{$benefits} Location {$location}\n\n{$description} \n\n If you would like to apply for this position please email {$emailadd} or call {$contact} at \n\Ltd\n330 7QT\nTel: +44 (0)1898\nFax: +44 (0)\n\nIf you wish to unsubscribe to $mycat mail list, please unsubscribe at http://www.y.com";
}
// Set up reply address for mailing list
$mailFrom = "u<jobs@y.com>";
// Ensure that subject and body of email have
// automatically inserted escape slashes removed
$name = " Employment";
$email = "jobs@g.com";
$title = $_POST["mailSubject"];
$sender = $email;
// Attempt to read subscriber file
$x=0;
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$table= "jobmailtest";
$sql5 = "SELECT * FROM $table WHERE mylist = '$listname'";
$resultsb = mysql_query($sql5) or die("An error ocurred :".mysql_error());
while ($row = mysql_fetch_array($resultsb)) {
$theid = $row["id"];
$sendout = $row["mymail"];
$theirname = $row["myname"];
$x= $x +1;
require_once "mailoutattach/mylib/Swift.php";
//change this to smtp
require_once "mailoutattach/mylib/Swift/Connection/SMTP.php";
//echo "$listname <br>$sendout, $theirname<br>";
require_once "mailoutattach/mylib/Swift/Plugin/Throttler.php";
//$swift =& new Swift(new Swift_Connection_SMTP("smtp.host.tld"));
$mailBody2 = "Dear $theirname,\n\n".$mailBody;
$body=stripslashes($mailBody2);
//Enable disk caching if we can
if (is_writable("/tmp"))
{
Swift_CacheFactory::setClassName("Swift_Cache_Disk");
Swift_Cache_Disk::setSavePath("/tmp");
}
$swift =& new Swift(new Swift_Connection_SMTP("localhost"));
$message =& new Swift_Message("Latest Vacancy" . $title);
$message->attach(new Swift_Message_Part($body));
$throttler =& new Swift_Plugin_Throttler();
$throttler->setBytesPerMinute(20000000); //Roughly 20MB
$swift->attachPlugin($throttler, "throttler");
//or maybe you want to set the number of messages per minute?
$throttler->setEmailsPerMinute(3); //Max of 1 email every 2 seconds
//Try sending the email
$sent = $swift->send($message, $sendout, $sender);
}
if ($sent)
{
$today =date("Ymd");
if ($x == $howmany){
echo "$x = $howmany";
$lastadd = $sendout;
$mymessage = "done sending $ID to all in the list -lat address is $lastadd Success!";
//$message->attach(new Swift_Message_Part($body));
$mailSubject = "notification";
$mailFrom = "jobs@y.com";
$mymail = "perry@y.com";
mail($mymail, $mailSubject, $mymessage, $mailFrom);
$stopped = "n";
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$sqlU = "UPDATE sendoutlist SET done = '$today', stopped = '$stopped', lastemail = '$lastemail' WHERE jobid ='$myID'";
$myresult2U = mysql_query($sqlU) or die("An error ocurred :".mysql_error());
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$sqlL = "UPDATE listcounter SET datedone = '$today', lastemail = '$lastemail' WHERE jobid ='$myID'";
$myresult2L = mysql_query($sqlL) or die("An error ocurred :".mysql_error());
}
if ($x > $howmany){
$lastadd = $sendout;
$mymessage = "done sending $ID to $lastadd Success!\n\nSent out $x";
$mailSubject = "notification";
$mailFrom = "jobs@y.com";
$mymail = "perry@y.com";
mail($mymail, $mailSubject, $mymessage, $mailFrom);
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$stopped = "n";
$sqlU = "UPDATE sendoutlist SET done = '$today', stopped = '$stopped' , lastemail = '$lastemail' WHERE jobid='$myID'";
$myresult2U = mysql_query($sqlU) or die("An error ocurred :".mysql_error());
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$sqlL = "UPDATE listcounter SET datedone = '$today', lastemail = '$lastemail' WHERE jobid ='$myID'";
$myresult2L = mysql_query($sqlL) or die("An error ocurred :".mysql_error());
}
if ($x < $howmany){
$lastadd = $sendout;
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$table= "jobmailtest";
$z= 0;
// For each vac line....
$sql2 = "SELECT * FROM $table WHERE mylist = '$listname'";
$results = mysql_query($sql2) or die("An error ocurred :".mysql_error());
while ($row = mysql_fetch_array($results)) {
$lastmail = $row['mymail'];
$z = $z + 1;
}
If ($z==$x){
$mymessage = "done sending $ID to $lastadd Success!\n\nSent out $x";
$mailSubject = "notification";
$mailFrom = "jobs@y.com";
$mymail = "perry@y.com";
mail($mymail, $mailSubject, $mymessage, $mailFrom);
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$stopped = "n";
$sqlU = "UPDATE sendoutlist SET done = '$today', stopped = '$stopped' , lastemail = '$lastemail' WHERE jobid='$myID'";
$myresult2U = mysql_query($sqlU) or die("An error ocurred :".mysql_error());
}else{
$mymessage = "done sending $ID Failed to complete, last email to $lastadd \n\nSent out $z";
$mailSubject = "notification";
$mailFrom = "jobs@y.com";
$mymail = "ros@y.com";
mail($mymail, $mailSubject, $mymessage, $mailFrom);
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$stopped = "y";
$sqlU = "UPDATE sendoutlist SET done = '$today', stopped = '$stopped' , lastemail = '$lastemail' WHERE jobid='$myID'";
$myresult2U = mysql_query($sqlU) or die("An error ocurred :".mysql_error());
}}
else{ $mymessage = "sending_failed $ID, Stopped on $sendout";
$mailSubject = "notification";
$mailFrom = "jobs@y.com";
$mymail = "ros@y.com";
mail($mymail, $mailSubject, $mymessage, $mailFrom);
// store last email out
require_once ("/home/arsenal/public_html/control/hideme/connect.inc");
$stopped = "y";
$sqlU = "UPDATE sendoutlist SET done = '$today', stopped = '$stopped' , lastemail = '$lastemail' WHERE jobid='$myID'";
$myresult2U = mysql_query($sqlU) or die("An error ocurred :".mysql_error());
//$swift->log->dump();
}}} //end of while
//echo"endit";
$swift->disconnect();Code: Select all
var_dump($swift);Code: Select all
$swift->disconnect();That IS all there wasJcart wrote:As per d11's request, the full error message. You have only included a small portion of the error.roscoe wrote:As per subject Call to a member function on a non-objectd11wtq wrote:Please can you post the full error message?I'm not too sure which bit of Swift to be looking at without the error.
I highly doubt that.. you should be seeing something likeroscoe wrote:That IS all there wasJcart wrote:As per d11's request, the full error message. You have only included a small portion of the error.roscoe wrote: As per subject Call to a member function on a non-object
Fatal error: Call to a member function bar() on a non-object in H:\wamp\www\Index.php on line 3