itzumar
Posts: 88
|
| Posted: 11/23/2012, 11:30 AM |
|
Hi!
I am developing HR system in code charge studio using php and MySQL. I want that when i generate employee report . IT should automatically go to employee email inbox. can anybody guide me? or give me simple code for that (new report automatically go to email of emplyee)
lot of thanks in advance :)
_________________
Umar |
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 11/23/2012, 7:39 PM |
|
what email class are you going to use to send emails?
_________________
Central Coast, NSW, Australia.
|
 |
 |
itzumar
Posts: 88
|
| Posted: 11/23/2012, 10:14 PM |
|
I am using after submit event in editable grid grid builder. but error message coming local and port25 not configures.
can u tell me any code for auto genrate email as i enter or update any record
_________________
Umar |
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 11/24/2012, 12:50 AM |
|
If you would like to use PHP Mailer I can provide a configuration for you...
_________________
Central Coast, NSW, Australia.
|
 |
 |
itzumar
Posts: 88
|
| Posted: 11/24/2012, 2:14 AM |
|
ok lot of thanks. plz provide
_________________
Umar |
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 11/24/2012, 11:26 PM |
|
This solution uses an smtp server....download PHP mailer from Sourceforge..and copy into includes folder.
***Here is sample custom code, where I am using the on click event of a button, and using various methods to set the value for mailer fields:
$duedate= $recordAsset->duedate1->GetValue();
$smtpserver = CCGetSession("smtpserver");
require('includes/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = $smtpserver;
$mail->SMTPAuth = $smtpauth;
$mail->Username = $smtpusername;
$mail->Password = $smtppassword;
$mail->Port = $smtpport;
$mail->From = $from;
$mail->FromName = $orgname;
$mail->AddAddress($recipient);
$mail->AddReplyTo("DO NOT REPLY");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = ($subject);
$mail->Body = ($body);
$mail->AltBody = ($Altbody);
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
}
note couple of things: smtpauth can be either true or false, and this settings specifies whether the SMTP server will request username and password. If you are developing at home you might have this set to false and not bother including username and password values. So your host might be $smtpserver or "smtp.yourisp.com".
_________________
Central Coast, NSW, Australia.
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 11/25/2012, 1:04 AM |
|
What format are you providing the report?
Will it be a .PDF? and sent as attachment to employee?
_________________
Central Coast, NSW, Australia.
|
 |
 |
itzumar
Posts: 88
|
| Posted: 11/25/2012, 10:17 AM |
|
now i am using web based report .
_________________
Umar |
 |
 |
bannedone
Posts: 273
|
| Posted: 11/27/2012, 9:35 AM |
|
Hi
After you have your E-Mail class configured use Michael's setup in the Before Output Event
Put his e-mail code in Custom Code for that event.
Use the $main_block value as your E-Mail content like so
global $main_block;
$mail->Body = ($main_block);
$mail->AltBody = (strip_tags($main_block));

Have Fun
_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2 |
 |
 |