mail php files

mail php files

by Lef Plom -
Number of replies: 14
Hi i'm new in moodle, so i want some help from an expert...

Here it is... Imagine that you are in the forum area. You are adding a new topic for a lesson and you want to inform the students whre are subscribed in this lesson for this new thread by emailing them. So the only thing you have to do is to check the checkbox which is named as "E-mail", right?

I want somebody, to tell me, which are the php mail files, doing the mail processing. I made a lot of search and i can't find something relevant. Please if somebody can help me, i would appreciate it.

Sorry for my bad english!!!
Average of ratings: -
In reply to Lef Plom

Απάντηση: mail php files

by Lef Plom -
Because nobody answered to my problem until now i will explain it differently...

In the forum there is a checkbox named "Email now"

All i need is the source code behind this check box... I guess that is the "process.php" file but i'm not quite sure, so i need and a second opinion from an expert... Please, it's important.... Thanks
In reply to Lef Plom

Re: Απάντηση: mail php files

by Steve Bilton -
I believe the location of the code is found in : /mod/forum/lib.php and post.php. The check box option is provided in post_form.php around line 62 in a 1.8 moodle version :

if (empty($post->id) && has_capability('moodle/course:manageactivities', $coursecontext)) {
$mform->addElement('checkbox', 'mailnow', get_string('mailnow', 'forum'));
}

You can only mail now if you have the capability to manage course activities.

Do a search for "mailnow" in the three files I mention to find the parts of the code where this is dealt with.

Hope that helps....

Steve
http://stcssafety.com


In reply to Steve Bilton

Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
Thank you very much Steve... I will check it... Thanks again!!!
In reply to Lef Plom

Re: Απάντηση: Re: Απάντηση: mail php files

by Philip Percival -
Even if you say mail now, I am not sure that it happens until the next cron job happens. But it does not wait for the editing time. (happy to be corrected here)

In /mod/forum/lib.php you will find the forum cron script.

this calls the function

email_to_user which can be found in

/lib/moodlelib.php

I am pretty sure that it is the email to user that does all the actual mailing,

Regards

Philip
In reply to Philip Percival

Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
Philip

Are you sure that email_to_user function does the mail process while you check the checkbox "email now"?

Lef
In reply to Lef Plom

Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Philip Percival -
Fairly sure, but.....

I have added a line to mine (BCC) and I know that it is dealing with normal forum posts and messages, digests and admin error alert messages.
In reply to Philip Percival

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
Ok Philip... Thank you very much...

I'll check it...
In reply to Lef Plom

Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Steve Bilton -
Just checked the behaviour of the mail now check box.

It does ignore editing time, mine is set to 24 hours.

It only mails after the Cron has been run/scheduled.

Has anyone found a way to email tutors copies of the posts upon creation (ignoring editing time); and Students are then emailed copies of the post as default??

Steve
http://www.sheilds-elearning.co.uk
In reply to Steve Bilton

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
I've only managed to send emails tutors by running cron only... I thing this is the only way to send mails through the forum....

Lef
In reply to Lef Plom

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
Hey i've got another (maybe silly) question

Is any relationship between function forum_cron(found on mod/forum/lib.php) and the php file cron.php(found on folder admin) in order to do the mail processing? Thanks and hope for replying...
In reply to Lef Plom

Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
cron.php is the main entry point for all cron tasks. It's job is to find all the tasks that need to be performed and invoke them.

So, for example, one of the things that admin/cron.php does is to load the lib.php file from every module, and, if it finds a xxx_cron function defined in there, it calls it.
In reply to Tim Hunt

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
I see...

Thanks for responding....
In reply to Lef Plom

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: mail php files

by Lef Plom -
How the files lib.php and moodle lib.php are connected? I mean which command does this fuction?