This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

michael.gorini9825568
michael.gorini9825568

Hello, I work with the lastest version of october and I encountered a problem.

When I send a mail using the base october system (templates) I don't receive it. I mean, even if i use the button "Send Test Message" I see the confirmation popup but anything is received in my inbox.

That's strange because I am using that method since september and everything worked fine, I think it could be the lastest update (build 431) that broke it. I really need a solution for this, thank you.

driss.chelouati27209
driss.chelouati27209

Hello, my problem is slightly different than yours but shares the same base. Iam very new to Octobercms, php and laravel, so i dont know a lot about it. I managed to develop a full website with Octobercms, including a blog, a forum and a user management system provided by rainlab plugins. I also created new layouts for my email notifications. These layouts work well when i send a test message. However, even after reading the email documentation, i can't understand where and how i should use the code to send an email based on an existing template. I would like to send an email to newly activated accounts, and also an email to the site admins when there is a new signup. Can you please help me and give me some advice ?

Where should i add this to send one of my templates on registration or activation success ?

// Send using an object's properties
Mail::sendTo($user, 'rainlab.user::mail.new_user', $params);

Are rainlab user's mail supposed to be preimplemented to be sent automatically or do we have to do it manually ?

driss.chelouati27209
driss.chelouati27209

Ok, i figured out a part of the solution. My first requirement was to send an email to my admin email account when a user registers on my site. In my register page, i created a function that listens to the rainlab.user.register event. Then i execute the code to send my email (after getting the variables i need for my template). Here is the code, hope it helps :

public function onInit()
{

    Event::listen('rainlab.user.register', function($user, $data) {
        $dataFilled =[
            "id" => $user->id,
            "name" => $user->name,
            "email" => $user->email
            ];

        Mail::sendTo('my-email-address@mail.com','rainlab.user::mail.new_user', $dataFilled, function($message)
            {
                $message->from('noreply@domain.tld', 'My Domain');
                $message->subject('A new user has signed up');
                $message->replyTo('noreply@domain.tld');
            }
        );
    });
}

Now i need to succeed sending an email to a user when his account is manually activated from the backend by an admin.

Last updated

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.