Stopping "Welcome to the course" emails

Stopping "Welcome to the course" emails

by Claire Jones -
Number of replies: 38

Is there any way to stop the "Welcome to the course" emails being sent out?  We have disabled the ability for students to edit their profiles, so this email is now irrelevant and causing some confusion.

Thanks

Average of ratings: -
In reply to Claire Jones

Re: Stopping "Welcome to the course" emails

by Andy Hawkins -

Don't know about stopping the mail itself, but you can change the text so it does not refer to the profile.

Look in lang/en/moodle.php

about line 1089 you should find the relevant text.

We replaced with spaces in case there was some fixed formatting in how the message was used by the system.

Doubt this will survive an upgrade. (we are using 1.4.3+)

I suspect there is a  better/proper way of doing this from the tech experts, but this seems to do the job for the time being.

Andy

In reply to Claire Jones

Re: Stopping "Welcome to the course" emails

by Klaus Schramm -
You can stop moodle sending enrolment e-mails by changing two lines in the file:
       .../enrol/enrol.class.php

The line (occuring twice in the file!) reads:
       email_to_user($USER, $teacher, $subject, $message);

It must be changed to:
//     email_to_user($USER, $teacher, $subject, $message);

That way, moodle ignores the e-mail-command until you change back to the original line.  The setting works for all courses at the same time.  It does not affect other e-mails being sent (e.g. the login confirmation).  To switch enrolment e-mails on/off for individual courses, more extensive changes are necessary.

Regards, Klaus
Average of ratings: Useful (1)
In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Paolo Oprandi -
I think there should be an option to turn this message off. Why would you want to be reminded to change your profile for each course you register?

Thanks for the pointer Klaus.
Paolo
Average of ratings: Useful (1)
In reply to Paolo Oprandi

Re: Stopping "Welcome to the course" emails

by Ger Tielemans -

You could call it computer literacy: students will realise that not humans but automata create this kind of friendly messages...

In reply to Ger Tielemans

Re: Stopping "Welcome to the course" emails

by Chardelle Busch -
Picture of Core developers
Or, change the language of the email and delete the part about the profile. I think it's nice to get the confirmation that you are enrolled.
In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Ben Jean -

Hello Klaus.

Thanks for your reply to this post. Sorry to piggyback off another topic, but based on your response, I was wondering if you could help me. We are using email authentication for new user signups. However, I wan't the confirmation emails that are sent to the users redirected to a specific email that I control. This will allow us to control who is creating an account by controlling whether they will be confirmed. If we decide to grant access, I can either select the activation link in that email or go through the edit user section under administration. Do you know where the code is that controls this confirmation email? Thanks for the help. smile

Ben

In reply to Ben Jean

Re: Stopping "Welcome to the course" emails

by Paolo Oprandi -
Hello Ben,

I guess you have figured this out by now but why not change $USER to the user you wished to be mailed?
email_to_user($USER, $teacher, $subject, $message);

Paolo
In reply to Ben Jean

Re: Stopping "Welcome to the course" emails

by Klaus Schramm -
Ben,

sorry for the late reply. In the current moodle (1.5.3+) go to the file ../enrol/enrol.class.php and comment out the two instances of the email_to_user-command:
//   email_to_user($USER, $teacher, $subject, $message);
This will suppress welcome messages after a user is subscribing to a course.

Now, changing the confirmation messages after a user is created in the moodle database, go to the file ../lib/moodlelib.php and look for the function:
function send_confirmation_email($user) {
At the end of this function you will find the line
    return email_to_user($user, $from, $subject, $message, $messagehtml);
Replace this line with
    return email_to_user($from, $from, $subject, $message, $messagehtml);
The user will no longer get the confirmation message. Instead, you will get it yourself and can confirm for the user.

If you want to monitor the self-registration process rather than stop it, you can add your own address to the confirmation without deleting the old one:
    return email_to_user($user, $from, $subject, $message, $messagehtml);
return email_to_user($from, $from, $subject, $message, $messagehtml);
Regards,
Klaus
Average of ratings: Useful (1)
In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Bernhard Hiegl -
Hi Klaus,

for me the monitoring doesn´t work.

This works:
Replace this line with
    return email_to_user($from, $from, $subject, $message, $messagehtml);
but unfortunately not the monitoring:
 return email_to_user($user, $from, $subject, $message, $messagehtml);
return email_to_user($from, $from, $subject, $message, $messagehtml);
In the first case I (admin) get the mail but in the second case only the user but not the admin receives a mail.
Any ideas?

Thanks, Bernhard
In reply to Bernhard Hiegl

Re: Stopping "Welcome to the course" emails

by Klaus Schramm -
Oops, sorry. There ought to be no more than one return. This should work:
  email_to_user($user, $from, $subject, $message, $messagehtml);
return email_to_user($from, $from, $subject, $message, $messagehtml);
Regards, Klaus
In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Cindy Koeppel -

Hi Klaus,

I am interested in monitoring the self-registration process rather than stop it.  I (the admin) want receive the confirmation and I want the user to receive the confirmation, too.

Following your post above, this is what I have included in the following file:

file ../lib/moodlelib.php

 email_to_user($user, $from, $subject, $message, $messagehtml);
 return email_to_user($from, $from, $subject, $message, $messagehtml);

However, only the user is receiving the confirmation e-mail.  What am I missing?

Thanks in advance for your assistance.

Cindy

In reply to Cindy Koeppel

Re: Stopping "Welcome to the course" emails

by Sylvain Houmeau -

HI Cindy. Your post is dated of March 07 but maybe you have had an answer since.

I am interested to find out about it. Are you able to monitor the registration? Do you also receive a copy of the confirmation email? How did you do it? Can you give me the details? I am running Moodle 1.8, and you?

Let me know.

Thank you.

Sylvain

In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Rhonda Goetz -

I would like to send the student's username and password in the email.  What do I need to add to the statement to get that?

Rhonda

In reply to Rhonda Goetz

Re: Stopping "Welcome to the course" emails

by Paolo Oprandi -
Rhonda,
Would changing the text in lang/en/moodle.php to include $user->username and $user->password work?
Paolo
In reply to Rhonda Goetz

Re: Stopping "Welcome to the course" emails

by Klaus Schramm -
Rhonda,

it was some time ago, but you might still look for the answer to your question (for moodle 1.5.3+):

In the file ../lib/moodlelib.php insert the yellow lines and comment out the one with the "fullname". This gives you more flexibility with the content of confirmation messages.
function send_confirmation_email($user) {
    global $CFG;
    $site = get_site();
    $from = get_admin();
//    $data->firstname = fullname($user);
    $data->firstname = $user->firstname;
    $data->lastname = $user->lastname;
    $data->username = $user->username;
    $data->email = $user->email;
    $data->sitename = $site->fullname;
    $data->admin = fullname($from) .' ('. $from->email .')';
Within your confirmation message (edit the value 'emailconfirmation' within ../lang/en/moodle.php) you can then use more valuables:
$string['emailconfirmation'] = 'Dear a->firstname $a->lastname ($a->username)
For your E-Mail-Adress ($a->email), an account has been... ';

Regards,
Klaus
In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Tony Delahunty -

>>You can stop moodle sending enrolment e-mails by comenting out two lines in the file:
       .../enrol/enrol.class.php

or you could in Moodle 1.5.   Anyone worked out how to do this in 1.6 ?

 

In reply to Tony Delahunty

Re: Stopping "Welcome to the course" emails

by Tony Delahunty -

I'll answer this myself in case anyone comes across this thread later.  The lines to comment out to stop "Welcome to the course" emails in a 1.6 installation are in ../enrol/manual/enrol.php.

(We do this because we leave course 'enrolment' open to all logged in users, ie we allow them click on any course area they wish, so we want to avoid them getting an identical ' Welcome to...' email, every time they wander of to explore some new area of our Moodle)

In reply to Klaus Schramm

回复: Re: Stopping "Welcome to the course" emails

by 慧慧 杨 -

I want to send email to my students.But there is no line"email_to_user($USER, $teacher, $subject, $message);"in .../enrol/enrol.class.php.

class enrolment_factory {
    function factory($enrol = '') {
        global $CFG;
        if (!$enrol) {
            $enrol = $CFG->enrol;
        }
        if (file_exists("$CFG->dirroot/enrol/$enrol/enrol.php")) {
            require_once("$CFG->dirroot/enrol/$enrol/enrol.php");
            $class = "enrolment_plugin_$enrol";
            return new $class;
        } else {
            trigger_error("$CFG->dirroot/enrol/$enrol/enrol.php does not exist");
            notify("Enrolment file $enrol/enrol.php does not exist");
        }
    }
}

Where should i add it?

Need your help.

Thank you .

In reply to Klaus Schramm

回复: Re: Stopping "Welcome to the course" emails

by 慧慧 杨 -

What shoule I do in the 1.8.3 version?

enrol.class.php have been updated.

In reply to 慧慧 杨

Re: 回复: Re: Stopping "Welcome to the course" emails

by Tony Chilvers -

Has anyone got a solution for this in later versions of Moodle.

I am using 1.9.2

In reply to Tony Chilvers

Re: 回复: Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Tony,

In case you have not found an answer to how to turn off the Welcome to the course emails, In version 1.9 there is a setting in the Site Administration Block under Courses->Enrollement to disable this.


In reply to Klaus Schramm

Re: Stopping "Welcome to the course" emails

by Noelia Romero -

Hello Klaus.

I'd like to send a e-mail notification to the user (with the username and password) when the admin/teacher enrol him in a course.

Thanks a lot.

Noelia

In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Noelia,

Are you wanting to send the students username and password for logging in to Moodle when their account is created or are the students already created and you want to send a reminder as to what their username and password are? I do not know of a automated way of doing either of these, I believe this is a manual process.

Or, are you creating courses with enrollment keys and want to send an email to all participants, registered in the course, the enrollment key? If this is the case, the Admin/Teacher can view all participants in the course Participant block and then select all participants to send a message to and create one message that will go to all selected participants.

In reply to Ron Meske

Re: Stopping "Welcome to the course" emails

by Noelia Romero -

Hi Ron,

I want send mail when an user is enrolled in a course (his account is already created). I also think it's a manual process; I think I have to modify some php functions, doesn't it? What function, do you know?

Thanks a lot.

In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Noelia,

There is a way to set Moodle to automatically send a user a Welcome message when they are enrolled in a course. But that would not automatically send any login information, that would require the teacher/admin to do this manually.

If you want to send account information, then a private message/email can be sent to the user through their Profile.

If you want to send the enrollment key for the course, then you can use the Participants block to select the enrolled users you want to send the enrollment key to and send a shared message.

If you just want a generic email message welcoming the student to the course, then, in version 1.9, there is a setting in the Site Administration Block under Courses->Enrollement to enable this.

Hope that helps point you in the right direction.

Ron
In reply to Ron Meske

Re: Stopping "Welcome to the course" emails

by Noelia Romero -

Hi Ron,

Thanks a lot for your help.

Really I'd like this process (email welcoming - not sending password because user is already joined to Moodle - the student when the teacher adds him to a course) to be automatically performed. At first side, I think it's not possible to configure this feature in Moodle, so I have to edit Moodle source, isn't it?

Thanks.

Noelia

In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Noelia,

Which version of Moodle are you using?

Can you explain exactly what you want the email to send?

Is it identical for all users, or does it need to contain unique information per user?

This will help determine if Moodle can do what you want without modification.

Thanks,
Ron
In reply to Ron Meske

Re: Stopping "Welcome to the course" emails

by Noelia Romero -

Hi Ron,

I'm using the 1.9.2 version of Moodle.

The mail could be somenthing like this (but in spanish smile):

-------------------------

Dear user, (hear we can replace 'user' by the name of the user, but it's not very important)

    You have been enrolled to the course "xxxx" (xxx=name of the course).

Regards

Moodle Adminstrator

--------------------------

Thanks. Noelia

In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Noelia,

I believe what you want then is already available in Moodle.
In the Site Administration Block select Courses and then select Enrollments. Scroll to the bottom of the page and change the setting for Send course welcome message to be Yes.

If you want to edit the standard message refer to this link: http://docs.moodle.org/en/Enrolment_plugins#Welcome_to_course_message

Ron
In reply to Ron Meske

Re: Stopping "Welcome to the course" emails

by Noelia Romero -

Hi Ron,

Thanks a lot. You are rigth, but this option is only available when the user self-enrol in a course, but not when is enroled by the teacher/admininstrator. In my case, this option is not usefull because I want the teacher/administrator to be the one to register users in each course and the user to receive a notification email.

Noelia

In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Michael I. Vickers -
On a slightly different point, can the policies be presented prior to completing the enrollment, ie, what you should know before enrolling in this class... ??


Mike
In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Noelia,

You are correct. This seems to be something that would be a nice addition and option.

Currently the only way you can accomplish this is to enroll all users then go to the Participants block and view all participants. You can then select all participants and send a message to them.

Thanks,
Ron
In reply to Ron Meske

Re: Stopping "Welcome to the course" emails

by Noelia Romero -

Hi Ron,

Do you know which function I have to edit in source code for adding this feature?

Thanks. Noelia

In reply to Noelia Romero

Re: Stopping "Welcome to the course" emails

by Ron Meske -
Picture of Particularly helpful Moodlers
Hi Noelia,

I would recommend that you use the functionality already built into the Participant Block. I think it will fit your needs quite well and not require any custom modification to Moodle.

If you really want to look into what it would take to make this type of modification, I can point you to the two files that are used for manual Course Enrollments, they are admin/roles/assign.html and admin/roles/assign.php.

A word of caution about modifying this to automatically send emails to anyone enrolled as a student. A user is automatically enrolled once they are moved from the "potential user" column to "existing user" column. So if a user is mistakenly added, they will get the welcome email even if they are removed. Which means you may want an automatic email for unenroll as well.

A better way may be to create a cron job that checks for new users in a course and then sends a welcome email. This would require a means of keeping track which users were sent the email already.

In either case, you may want to contact a Moodle Partner to make these type of changes.

Ron

In reply to Ron Meske

Re: Stopping "Welcome to the course" emails

by Luan Meades -

Do you think I would be able to change this so it sends out a copy of the welcome message to the teachers so they are aware that they have a new student.

We are using 1.9

In reply to Luan Meades

Re: Stopping "Welcome to the course" emails

by Jeff Jones -

Sorry if I'm posting to the wrong group....

Similar problem.  The automated email is being generated from one (of several) instructors/facilitators in the course.  Is there a way to specify which person the email will be generated from when a user self enrolls in a course.  We have multiple instructors and they would like the email generated from a particular instructor.

Can anyone tell me how $from is populated?

Tks, Jeff...

In reply to Jeff Jones

Changing 'From' in 'Welcome to the course' emails | v.2.3.1

by Francois Evans -

I have a similar problem posted here:

https://moodle.org/mod/forum/discuss.php?d=214592#p934782

The auto-emails being sent out to users every time they enrol on a new course, are being sent from a staff member on the course who is not the course leader. (I don't know how Moodle chooses the from person, but it seems almost arbitrary.)

How to I change the name of the 'from' person in these automated emails?

Thank you!