Jump to content
dimitris

Email individual pilot. (to his registered mail address)

Recommended Posts

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 '<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;
	}
	$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('<br>', '<br />', $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

  • Like 6

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 rolleyes.gif

Thanks!

Share this post


Link to post
Share on other sites

Double check your link. It should look like this

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...