The reason I couldn't see an operator online was that I hadn't added him to a group (duh).
To fix the e-mail problem I used this LGPL library:
http://phpmailer.worxware.com/index.php?pg=phpmailerI didn't work out exactly how to incorporate it into the code for good, but this is what I've done in common.php
function webim_mail($toaddr, $reply_to, $subject, $body) {
global $webim_encoding, $webim_mailbox, $mail_encoding;
$headers = "From: $webim_mailbox\r\n"
."Reply-To: ".myiconv($webim_encoding, $mail_encoding, $reply_to)."\r\n"
."Content-Type: text/plain; charset=$mail_encoding\r\n"
.'X-Mailer: PHP/'.phpversion();
$real_subject = "=?".$mail_encoding."?B?".base64_encode(myiconv($webim_encoding,$mail_encoding,$subject))."?=";
$body = preg_replace("/\n/","\r\n", $body);
$is_smtp = true;
if ($is_smtp) {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.server.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "webmaster@mydomain.com"; // GMAIL username
$mail->Password = "secretpass"; // GMAIL password
$mail->From = "support@mydomain.com";
$mail->FromName = "My Site";
$mail->Subject = $real_subject;
$mail->AltBody = $body; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddReplyTo("support@ mydomain.com","My Site");
$mail->AddAddress($toaddr, $toaddr);
$mail->IsHTML(false); // send as HTML
$mail->Send();
} else {
@mail($toaddr, $real_subject, wordwrap(myiconv($webim_encoding, $mail_encoding, $body),70), $headers);
}
}
I'm still trying to work out how to get the formatting right, but that should get anyone with the same problem going.
What do you think about HTML formatting of the chat history. Too many e-mail clients ignore line breaks in text and try to run them all together.