Minor fixes for recent mail to email feature.

This commit is contained in:
Retro_Guy 2024-10-08 09:51:34 -07:00
parent 59a5eb7f4d
commit dac8126900
2 changed files with 12 additions and 10 deletions

View File

@ -181,7 +181,7 @@ if ($do_mail_update == true) {
function import_user_message($from, $rcpt, $date, $subject, $message)
{
global $config_dir, $spooldir, $OVERRIDES;
global $CONFIG, $config_dir, $spooldir, $OVERRIDES;
if (($to = get_config_value('aliases.conf', strtolower($rcpt))) == false) {
$to = strtolower($rcpt);

View File

@ -254,15 +254,17 @@ if (isset($_POST['sendMessage'])) {
}
// Send internet email notification here
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $to . '.config'));
if ($user_config['send_mail_to_email'] == 'true') {
$email_subject = "New Mail in your Inbox from " . $from . " on " . ltrim($CONFIG['server_path'], "@");
if (get_user_config($to, 'email_verified') == 'true') {
if ($email_address = get_user_config($to, 'email')) {
$message = "\nYou have received mail from " . $from . " on " . ltrim($CONFIG['server_path'], "@") . "\n\n-----\n" . $message;
$message = rtrim($message);
$message .= "\n-----\n\nTo Reply, log into site and view Mail";
send_internet_email($email_subject, $message, $email_address);
if (strpos('@', $to) === false) {
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $to . '.config'));
if ($user_config['send_mail_to_email'] == 'true') {
$email_subject = "New Mail in your Inbox from " . $from . " on " . ltrim($CONFIG['server_path'], "@");
if (get_user_config($to, 'email_verified') == 'true') {
if ($email_address = get_user_config($to, 'email')) {
$message = "\nYou have received mail from " . $from . " on " . ltrim($CONFIG['server_path'], "@") . "\n\n-----\n" . $message;
$message = rtrim($message);
$message .= "\n-----\n\nTo Reply, log into site and view Mail";
send_internet_email($email_subject, $message, $email_address);
}
}
}
}