Hi
I have tried different copy/paste/"change a bit" tricks a could come up with.
All I wanna do is send an e-mail to all staff, when a new canned response is created and/or a response has been changed?
Anyone has a very good idea?
It will be highly appreciated.
send mail, canned responses
Moderator: mkoch227
send mail, canned responses
As always, thanks in advance :-)
Try something like
Code: Select all
$admins=array();
$sql = "SELECT `email` FROM `hesk_users`";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql");
while ($myuser=hesk_dbFetchAssoc($result)) {$admins[]=$myuser['email'];}
$email=implode(',',$admins);
mail($email,"New canned response added","A new canned response has been added to ...");
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ok, whats wrong with this one
Thank you very much for that, I have a small problem, when I use this code, the mail doesn't have anything in "From" field
If I leave these to lines out,
$headers="From: $hesk_settings[noreply_mail]\n";
$headers.="Reply-to: $hesk_settings[noreply_mail]\n"; it says its from www, where does the www come from?
$admins=array();
$sql = "SELECT `email` FROM `hesk_users`";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql");
while ($myuser=hesk_dbFetchAssoc($result)) {$admins[]=$myuser['email'];}
$email=implode(',',$admins);
/* Get e-mail message for customer */
$fp=fopen('emails/canned_response.txt','r');
$message=fread($fp,filesize('emails/canned_response.txt'));
fclose($fp);
$message=str_replace('%%message%%',$msg,$message);
$message=str_replace('%%title%%',$savename,$message);
$message=str_replace('%%NAME%%',$name,$message);
$message=str_replace('%%SUBJECT%%',$subject,$message);
/* Send e-mail */
$headers="From: $hesk_settings[noreply_mail]\n";
$headers.="Reply-to: $hesk_settings[noreply_mail]\n";
mail($to = "user@domain.dk",$hesklang['canned_response'].$subject,$message,$headers);
If I leave these to lines out,
$headers="From: $hesk_settings[noreply_mail]\n";
$headers.="Reply-to: $hesk_settings[noreply_mail]\n"; it says its from www, where does the www come from?
$admins=array();
$sql = "SELECT `email` FROM `hesk_users`";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql");
while ($myuser=hesk_dbFetchAssoc($result)) {$admins[]=$myuser['email'];}
$email=implode(',',$admins);
/* Get e-mail message for customer */
$fp=fopen('emails/canned_response.txt','r');
$message=fread($fp,filesize('emails/canned_response.txt'));
fclose($fp);
$message=str_replace('%%message%%',$msg,$message);
$message=str_replace('%%title%%',$savename,$message);
$message=str_replace('%%NAME%%',$name,$message);
$message=str_replace('%%SUBJECT%%',$subject,$message);
/* Send e-mail */
$headers="From: $hesk_settings[noreply_mail]\n";
$headers.="Reply-to: $hesk_settings[noreply_mail]\n";
mail($to = "user@domain.dk",$hesklang['canned_response'].$subject,$message,$headers);
As always, thanks in advance :-)
That's the default PHP setting, include the From: header (reply-to isn't necessary) to display the correct from address.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools