Quickmail Update - Groups

Quickmail Update - Groups

by Mark Nielsen -
Number of replies: 42
Made a few updates to Quickmail. For those who do not know, Quickmail is a block that allows teachers to send emails to their students. Also keeps a history of all sent emails. The newest version of Quickmail can be found here: CVS/contrib/block_ quickmail_1.5

Here are the changes:
  • [New] Quickmail is now group aware. The users in the To: section of the email will be organized in their groups if groups is enabled for the course. The group's name, picture and a button for selecting/deselecting everyone in the group is displayed as well.
  • [New] Added a Cancel button on the compose email page.
  • [Changed] Emails are saved into history regardless of a failure when sending. Also, only users who are successfully emailed are stored in the history.
  • [Changed] Now checks to see if a user's email is disabled. If disabled, that user is not emailed and their name is reported to the screen.
Check it out if you like and please report any bugs to this thread.

Cheers,
Mark
Average of ratings: -
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Julian Ridden -
Just installed and get the folowing errors when viewing email.php

Warning: array_keys(): The first argument should be an array in /home/moodle/public_html/blocks/quickmail/email.html on line 147

Warning: in_array(): Wrong datatype for second argument in /home/moodle/public_html/blocks/quickmail/email.html on line 169

Warning: in_array(): Wrong datatype for second argument in /home/moodle/public_html/blocks/quickmail/email.html on line 169

Warning: in_array(): Wrong datatype for second argument in /home/moodle/public_html/blocks/quickmail/email.html on line 169

Warning: in_array(): Wrong datatype for second argument in /home/moodle/public_html/blocks/quickmail/email.html on line 169

Warning: in_array(): Wrong datatype for second argument in /home/moodle/public_html/blocks/quickmail/email.html on line 169
In reply to Julian Ridden

Re: Quickmail Update - Groups

by Mark Nielsen -
Thanks for posting this and doing it so quickly!  I believe that you got this error when you have groups turned on in the course and you have groups defined, but no group members are in those groups (well, that was how I reproduced those errors).  So, I fixed those bugs and made the group output more user friendly.  All changes are committed to CVS.

Cheers,
Mark
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Julian Ridden -

You were right. Forgotten I had emptied all my classes in preperation for the new year.

Code fix you posted work flawlessly...Many Thanks

In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Matt Crosslin -
I love the Quickmail block.  This may have been answered before, but I have always wondered why students can't use this function?
In reply to Matt Crosslin

Re: Quickmail Update - Groups

by Mark Nielsen -
We were afraid of students spamming each other and we have received few requests to implement this.

I unfortunately do not have enough time to add this feature into Quickmail.  If you would like to make it available to your students though, you can change your code in one of two ways:

1. (easy) Look for isteacher function calls and add an or isstudent.

For example:

if (!isteacher($course->id)) {

changes to:

if (!isteacher($course->id) or !isstudent($course->id)) {

2. (harder, but more flexible) Set up Quickmail to have a global setting that sets all Quickmail blocks available to teachers only or to teachers and students. This can be done with a config_global.html file and by updating the Quickmail code to look at the new setting. This may help you out. If you go this route, send me the code for review and I'll add it to contrib.

Good luck,
Mark
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Alexandra Gómez -

Hello Mark.

I've made the changes you suggested in order to make Quickmail available for students but haven't been able to make it work. Could you please tell me which specific files should I change? blush

Thanks!!

In reply to Alexandra Gómez

Re: Quickmail Update - Groups

by Mark Nielsen -
You will have to make changes to the following files:
  • block_quickmail.php
  • email.php
  • emaillog.php
Cheers,
Mark
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Alexandra Gómez -
Hello Mark.
If I install Quickmail with the modified files I get an error "Unable to make a quick test" or something like that. But If I install your version and then change the files for the ones I modified I don't get that error, but I can't see the block at all. The problem is when I change block_quicmail.php.
 
Could you please help me? I need to get this working asap.
 
Thanks!
In reply to Alexandra Gómez

Re: Quickmail Update - Groups

by Mark Nielsen -
I'm not sure what you mean by "modified files."  If you modified them, then you are on your own.

As for the error, I cannot find that one in the original code.  So I cannot help you there.

Cheers,
Mark
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Kevin Hughes -
Great block, by the way - it's something teachers have been asking me to do for a while.

One problem is that, if there's an error, the header gets printed twice - which looks untidy. Fortunately, there's a simple fix for this; I just moved the code which checks for errors so it happens before the usual header is output.

Basically, in email.php, cut & paste lines 20-26 to line 15.
In reply to Kevin Hughes

Re: Quickmail Update - Groups

by Mark Nielsen -
Hi Kevin,

Thanks for your complement and for your bug report!  I made your changes to Quickmail in contrib.

Cheers,
Mark
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Bernard Davis -

This may sound a bit stupid, but where can I download this from, I've been asked to make this sort of facility available but apoart from the iniial installation I have never done anything with Moodle.

Regards,

Bernard D

In reply to Mark Nielsen

QuickMail (Not Logged Error)

by gle gle -

Hello All,

After I send a quickmail message to students in any of my classes I get the error

"email not logged" at the top of my page.

Does anyone have any idea of why this is happening?

My logged file in the blocks folder is set to 777.

Thanks for your time and consideration.

GLE

In reply to gle gle

Re: QuickMail (Not Logged Error)

by Mark Nielsen -
Have you visited the admin screen to install Quickmail's table?

Cheers,
Mark
In reply to gle gle

Re: QuickMail (Not Logged Error)

by Matthew Koelling -

Did you ever find a solution this this problem. I am having the same error. The email sent from Quickmail works, it is just not logged in the history.

In reply to Matthew Koelling

Re: QuickMail (Not Logged Error)

by Matthew Koelling -

I fixed the problem. An early version of Quickmail was installed. Essentially it was trying to update the MySQL table, but attachments didnt allow Null values.

Installing the latest version for 1.9 fixed the problem.

In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Mark Nielsen -
Small updates and fixes today (all in CVS contrib). Here is my cvs log:

  • [Fixed] Removed a notice regarding $attachname not being set (in email.php).
  • [Changed] Names are now printed by using fullname() function and fullname override is true so first and last names are always printed (in email.html).
  • [Changed] Converted those nasty tabs into spaces.
  • [New] Added labels around the names so if you click the name, the check-box will check or uncheck (in email.html).
Cheers,
Mark
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by Matt Crosslin -
Here are the files that I have used to make this quickmail available to students. I added a script in the footer of the block that only displays to the teacher. It tells the teacher what access levels the Quickmail block has (teacher only or student and teacher). Then there is a link to change this. There is a database that tracks the Quickmail level for each course. It's structure is this:

CREATE TABLE mdl_block_quickmail_level (
id int(10) NOT NULL auto_increment,
courseid int(10) NOT NULL default '0',
level int(1) NOT NULL default '1',
PRIMARY KEY (id)
) TYPE=MyISAM AUTO_INCREMENT=3 ;

Where 'mdl' is the prefix you have choosen for your installation.

I updated the following files to read the database and allow the appropriate access to the appropriate pages (but guests never get to see anything, to avoid spamming):
  • block_quickmail.php
  • email.php
  • emaillog.php
In addition, I created a file that makes the change to the database when the teacher changes levels. This one is probably the least Moodle looking, though:
  • change.php
I used the latest Quickmail files that were on your site, but I don't know if those were THE most recent ones, so feel free to slice and dice these.
In reply to Matt Crosslin

Re: Quickmail Update - Groups

by Matt Crosslin -
I found a glitch in these files that basically shuts down the admin area.  Here is the changed files with the glitch fixed.
In reply to Matt Crosslin

Re: Quickmail Update - Groups

by Mark Nielsen -
Hi Matt,

Thanks for contributing to Quickmail.  I'll take a look at the code next week and then, more than likely, add it to the CVS.

Cheers,
Mark
In reply to Matt Crosslin

Re: Quickmail Update - Groups

by Joel Pheasant -
When I tried to use the changethis link to change the permissions, it wouldn't work for me.  Initially it displayed nothing on the page, stopping with the code right after the div tag.  I was able to get past this by commenting out the following lines:

//if (!isset($this->change)) {
//    $this->change = '';
//}

After doing that, the page displayed but it failed to actually update the levels in the table.  I believe I have this fixed now by changing the two lines that read:

    $updatelevel->id = $idcheck->courseid;
to instead read:
    $updatelevel->id = $idcheck->id;

It looked as though it was using the courseid to tell it which record to update instead of the id, which was causing it not to work on my install. 

Everything seems to work for me now, but let me know if the changes I made are likely to mess something else up.

Thanks,
Joel

In reply to Joel Pheasant

Re: Quickmail Update - Groups

by Alexandra Gómez -
Hello Joel.
I made the changes you mentioned but I' still getting the error: Unable to set User level.

AGS
In reply to Alexandra Gómez

Re: Quickmail Update - Groups

by Joel Pheasant -
Alexandra-
If you send me that page of code, I'll take a look and see if I can figure out anything I forgot to mention. You did add the mdl_block_quickmail_level table to control the permissions correctly, right? (I missed it at first...)

Joel
In reply to Alexandra Gómez

Re: Quickmail Update - Groups

by Matt Crosslin -
Is that the exact error you are getting?  The only error built in to that page reads like this:

Could not update level

If you are getting something else, there is an error somewhere else.  If you are getting that error, then PHP could not access your database for some reason.
In reply to Matt Crosslin

Re: Quickmail Update - Groups

by Alexandra Gómez -
Yes Matt. That's exactly the message I get. Here's the screen shot. It's weird because everything else works fine.


Attachment error.gif
In reply to Alexandra Gómez

Re: Quickmail Update - Groups

by Joel Pheasant -
The "unable to set User level" message is generated on line 45 of the block_quickmail.php file.  It looks like it is generated when there is an error inserting (not updating) a record into the block_quickmail_level table, so I would again check to make sure that everything is set up correctly on that table.
In reply to Joel Pheasant

Re: Quickmail Update - Groups

by Alexandra Gómez -
Now I'm getting a much weider error. Until now, I was working on my test server. When I got your post, I installed Quickmail on my production server but couldn't find it on the block section. To my surprise, when I visit the Admin page I see the error "Block quickmail is not compatible with the current version of Mooodle and needs to be updated by a programmer." Both servers have the same Moodle version Moodle 1.5.3+ (2005060230) sad. Any ideas??
In reply to Alexandra Gómez

Re: Quickmail Update - Groups

by Mark Nielsen -
You could try deleting Quickmail in Admin->Blocks and then re-installing it.  Not sure why you are getting this error though mixed

Cheers,
Mark
In reply to Joel Pheasant

Re: Quickmail Update - Groups

by Matt Crosslin -
Well, ultimately, the blockmail_level id is tied to the courseid in that table, so that really shouldn't make a difference.  It would still use the same record, regardless of which number you use.

The line that you commented out basically just says if there isn't a "change" variable in the address, then set it to null.  It's really not a needed line, but I don't know why it would cause problems.   Unless your PHP is not reading the GET change variable.  I deleted it out of mine and it didn't affect anything.  Changing the courseid to just id really didn't seem to affect anything either, so it should work fine.  Just make sure you get it in both places that it occurs.
In reply to Matt Crosslin

Re: Quickmail Update - Groups

by Matt Crosslin -
Oh, yeah - I've also noticed that after adding the Quickmail block to a new page, the student view feature doesn't always kick off at the same time.  I just refresh the page, or surf to another page and then surf back.  that usually kicks of the function to create the table and start the function.
In reply to Mark Nielsen

Re: Problems with Quickmail

by N Hansen -
I installed this block two days ago and found two rather serious flaws in it. The first was that it keeps no log as it is supposed to do. Secondly, I used it in my "site" course and am admin. When the students hit reply to the email, it fills in the To: field thus:

"Do not reply to this email <email@email.com>"

Not very helpful when I am asking them to reply.
In reply to N Hansen

Re: Problems with Quickmail

by Mark Nielsen -
The first was that it keeps no log as it is supposed to do.

I'm not sure where it says that Quickmail or blocks in general should log its activities.  I did a grep on the blocks directory and didn't find any add_to_log function calls.  Quickmail does keep a history, this acts like a log for each user.  Would you find it useful to see logs like "User viewed" and "User sent"?  If it is, then it is easy to add wink

Secondly, I used it in my "site" course and am admin. When the students hit reply to the email, it fills in the To: field thus:

"Do not reply to this email <email@email.com>"

Quickmail uses the current user's email address for the from part of the email.  Perhaps your admin's email is blocked or is it actually email@email.com?

Cheers,
Mark

In reply to Mark Nielsen

Re: Problems with Quickmail

by Dave Kirkpatrick -
In regards to the statement "When the students hit reply to the email, it fill in the To: field thus:....", We're experiencing the same thing. The From field of the email is correctly using the address of the person that sent the mail. The Reply-to field is defaulting to the system administrator's email. When the recipient of the email clicks "Reply" in his/her email client, the reply doesn't go to the person that sent the original mail. It goes to the system admin. Is this behavior by design? Shouldn't the Reply-to field also be set to the person that sent the mail?

Thank you,
Dave K
In reply to Dave Kirkpatrick

Re: Problems with Quickmail

by Glen Gross -
I have Quickmail running with 1.8.2 and the reply now sends back to the users "firstname"@xxxx.xx
We would also like it set to the person that sent the mail.
Best regards,
Glen
In reply to Glen Gross

Re: Problems with Quickmail

by Andy Tagliani -
First i think, this is not really a system problem, the problem sit in front of the system. we have a noreply address, the user send always back to the noreply address. the easiest way must be, the sender should tell the users the return mail address inside the message. can this be really a problem? ... yes it is a problem!

i hope there is a workarround that quickmail grabb the email address from the user who send the mail.

andy
In reply to Mark Nielsen

Re: Quickmail Update - Groups

by DoVisH DoVisH -

How can I have all the students names ordered by name so I can email perhaps all the students with theirs names started with A? or B or C?

It has something to do with print_table() function?

Thanks in advance

In reply to Mark Nielsen

Re: Quickmail Update - Groups

by J R -

I have installed quickmail and I have issues sending quick mail to groups. I have Moodle 2.5.2 version. I am able to choose individual students and send out the email but when choosing a specific group the system spins and nothing is being send out; however the history records the email.

Please help