About › Support › Bulk email › How to send emails?
- This topic is empty.
-
AuthorPosts
-
3rd March 2011 at 9:42 pm #2564Jay JonesMember
I have found the settings to modify, but I don’t see where to actually send messages.
3rd March 2011 at 10:29 pm #3353Jay JonesMemberA quick followup… I do not have options in my navigation to send email or sms. I tried appending “church_admin_send_email” to the end of my admin URL, and am given the error, “You do not have sufficient permissions to access this page.”
I’m not sure why this would be. I am the full admin of the WP installation.
3rd March 2011 at 10:37 pm #3354Jay JonesMemberA little further investigation… the Index.php has an if() statement at line 142 looking for cronemail.php in the includes folder in order to display the page. Since this file does not exist, it’s not showing. Any ideas on this?
3rd March 2011 at 10:42 pm #3355Andy MoyleKeymasterBulk Sms and email will only work once you have filled in and submitted the forms on the “communication settings” page. The form then creates the file that does the sending according to your preferences. Once you have submitted it, a link appears to let you send emails and/or sms
3rd March 2011 at 11:48 pm #3356Andy MoyleKeymasterSorry – my reply has crossed yours!
The cronemail.php file is created when “communication settings” email form is submitted. Hence the if statement in line 142 of index.php.
BTW If you had upgraded the plugin, you have to submit the email settings form, even though the values are shown, to recreate the cronemail.php file – in the next version, on upgrading, reactivation will check to see if settings have been stored previously and recreate it for you
4th March 2011 at 10:18 pm #3357Jay JonesMemberHmm… I appreciate the reply! I’ve submitted the form a few times, and this file isn’t getting created. Not sure why that would be.
4th March 2011 at 10:37 pm #3358Andy MoyleKeymasterMust be some sort of permission issue – although though that should have thrown an error. Check the permissions on the include directory.
I’ve had the plugin working on a number of sites I own and a client and it’s created the file well on unix servers and my home windows server.
Judging by your earlier post, you sound as though you could create cronemail.php and upload it to the includes file using this code which is for cron type… Just change teh db prefix if it isn’t wp_ and add your db login credentials…
Code:$attachment=array();// connect to database
$db=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
mysql_select_db(DB_NAME);
//initialise phpmailer scriptrequire(“class.phpmailer.php”);
$mail = new PHPMailer();
//Grab messages
$sql=”SELECT * FROM wp_church_admin_email ORDER BY email_id LIMIT 0,90″;//change prefix if necessary, 90 is the number of emails per hour. Change as needed!
$result=mysql_query($sql);
if(mysql_num_rows($result)>0)
{//only proceed if emails queued in db
while($row=mysql_fetch_assoc($result))
{
$mail->From = $row[‘from_email’];
$mail->FromName = “{$row[‘from_name’]}”;
$mail->IsHTML(true);$mail->AddAddress($row[‘recipient’]);
if(!empty($row[‘copy’]))$mail->AddAddress($row[‘copy’]);
if(!empty($row[‘attachment’]))
{
$path=$row[‘attachment’];
$mail->AddAttachment($path, $name = “”, $encoding = “base64”,$type = “application/octet-stream”);$attachment[]=$path;
}
$mail->Subject = $row[‘subject’] ;
$mail->Body=$row[‘message’];
if($mail->Send())
{
//successful send, so delete from DB
$sql=”DELETE FROM wp_church_admin_email WHERE email_id='”.mysql_real_escape_string($row[’email_id’]).”‘”;//change prefix if necessary
mysql_query($sql)or die(mysql_error());}
echo $mail->ErrorInfo;
$mail->ClearAllRecipients();//clears all recipients
$mail->ClearCustomHeaders();//clears headers for next message
}
}
?>4th March 2011 at 10:48 pm #3359Andy MoyleKeymasterAh. It’s just occurred to me that I’ve always tested wp-cron after cron – so cronemail.php has been created. If you were setting up the communication settings with wp-cron only, it is never going to work! redface š³
Line 142 of index.php change that if () to
Code:if(get_option(‘church_admin_cron’)==’wp-cron’||file_exists(CHURCH_ADMIN_INCLUDE_PATH.’cronemail.php’)) add_submenu_page(‘church_admin/index.php’, ‘Send Bulk Email’, ‘Send Bulk Email’, ‘administrator’, ‘church_admin_send_email’, ‘church_admin_send_email’);and it’ll work if you are a wp-cron kind of guy.
Another next release fix!
4th March 2011 at 10:53 pm #3360Jay JonesMemberThanks so much, Andy, and thanks for the work you put in on this. My includes directory has 755 permissions, so should be good for this, wouldn’t you think?
I’ll create this file and see how it goes, thanks for sharing that. Also, in addition to pastoring two churches in Michigan, USA, I am a designer/developer for http://www.visualhero.com and pretty well experienced with php and expert front-end coder… if I can be of any help with this project, please let me know.
Thanks again!
4th March 2011 at 10:54 pm #3361Jay JonesMemberExcellent! (my post crossed yours )
4th March 2011 at 11:18 pm #3362Jay JonesMemberQuick update. I first tried adding your fix to line 142, and then submitting my settings again… the file wasn’t created.
I did created it manually though, per your previous post, and it worked like a charm. I still don’t know why it didn’t create automatically, though!?
-
AuthorPosts
- You must be logged in to reply to this topic.