Email individual pilot. (to his registered mail address)

Email individual pilot.

Current version: v1

Tested on: 2.1.93

Email individual pilot is a module that allow you to send a mail a a certain pilot to his email address from inside the phpVMS admin panel.

Installation:

  1. Upload mailer_mailpilot_form.tpl to your /admin/templates folder on ftp.

  2. Insert the following lines at your MassMailer.php file located at /modules/MassMailer on your ftp.

    #------------Individual Pilot Mailing------------------------------------------------------------
    #Copyrights dimitris phpvms forum
    public function mail_pilot() {
    $this->render(‘mailer_mailpilot_form.tpl’);
    }
    public function sendmail_pilot(){
    echo ‘

    Sending email…

    ’;
    if($this->post->subject == ‘’ || trim($this->post->message) == ‘’)
    {
    $this->set(‘message’, ‘You must enter a subject and message!’);
    $this->render(‘core_error.tpl’);
    return;
    }
    $subject = DB::escape($this->post->subject);
    $emailp = DB::escape($this->post->email_pilot);
    $message = stripslashes($this->post->message). PHP_EOL . PHP_EOL;
    $message = str_replace(‘
    ’, ‘
    ’, $message);
    Util::SendEmail($emailp, $subject, $message);
    echo ‘Completed! Email sent.’;
    LogData::addLog(Auth::$userinfo->pilotid, ‘Sent a private mail’);
    return;
    }
    #----------------------------------------------------------------------------------------------

  3. Save and close MassMailer.php and upload to your site.

  4. Navigate to " www.yoursite.com/admin/index.php/massmailer/mail_pilot " and test it.

Note: This is my first admin side module. For any problems please report.

Thanks!

[mailer_mailpilot_form.zip](< base_url >/applications/core/interface/file/attachment.php?id=687)

Parse error: syntax error, unexpected T_PUBLIC in /home/virtualf/public_html/admin/modules/MassMailer/MassMailer.php on line 109

Am I supposed to replace something? If I were to paste this at the ent of the original .php file, I get that error. Line 109 is the start of your code above.

I type it wrong sorry…

Place the lines under the

public function index()
{
	$this->set('allgroups', PilotGroups::getAllGroups());
	$this->render('mailer_form.tpl');
}

and above the

public function sendmail()
{
	echo '<h3>Sending email</h3>';
	if($this->post->subject == '' || trim($this->post->message) == '')
	{
		$this->set('message', 'You must enter a subject and message!');
		$this->render('core_error.tpl');
		return;
	}

So it will look like this:

http://pastebin.com/B4XRWg6y

worked first time Thanks great add-on!!!

I also added a link to the admin centre so you can access the feature from within the admin centre.

just add “Email individual pilots” and make it a link " www.yoursite.com/admin/index.php/massmailer/mail_pilot " to Admin/templates/core_navigation.tpl

which will take you straight to it from within the admin centre.

Scott

Thanx dimitris, it works now. +1

Is it possible to get a search box to look for the pilot instead of a drop down please?

Yes it is You need a textbox and some javascript/jquery code to search the MySQL table. I m not familiar with this type of coding… I m sorry but I can’t help with this, anybody else is welcomed to edit the module

Thanks!

I hope so!

Double check your link. It should look like this

<li><a href="<?php echo adminurl('/massmailer/mail_pilot'); ?>">Email Individual Pilot</a></li>

thank you very much for this it works great.

Works perfect, ty

I realize this is an old thread, but how can I make the {PILOT_ID} {PILOT_FNAME} {PILOT_LNAME} functions work with this?

bump

what do you want to do ?

what do you want to do ?

make the {PILOT_ID} {PILOT_FNAME} {PILOT_LNAME} functions work

I doubt that these are functions. I think they are just replaced in the module before the mail is sent.

With str_replace for example.

Does anyone know how it works that “{PILOT_ID} {PILOT_FNAME} {PILOT_LNAME}” this system works?

Through the coding, those variables pull the pilots ID, first name and last name to be placed into the email.