Page 2 of 2

Re: Email piping and simple email from mail()

Posted: Tue Sep 25, 2012 3:37 pm
by kabuc
Klemen wrote:Send 3 sample emails to pop3test AT hesk DOT com and I will see what comes at my end.
I send from to different emails. subejt emails (test sample(2))

Re: Email piping and simple email from mail()

Posted: Thu Sep 27, 2012 8:44 am
by Klemen
Can you let me know what version of PHP are you running?

Also, please try this:

1. open file inc/pipe_functions.inc.php in a text/html editor
2. find

Code: Select all

$tmpvar['name'] = hesk_input($results['from'][0]['name']) or $tmpvar['name'] = $hesklang['pde'];
3. instead of that code use

Code: Select all

if ( empty($results['from'][0]['name']) )
{
	$tmpvar['name'] = $hesklang['pde'];
}
else
{
	$tmpvar['name'] = $results['from'][0]['name'];
	if (! empty($results['subject_encoding']) && strtoupper($results['subject_encoding']) != 'UTF-8' )
	{
		$tmpvar['name'] = iconv($results['subject_encoding'], 'UTF-8', $tmpvar['name']);
	}
}
4. save, upload and test.

Does this help with the name issue?

Re: Email piping and simple email from mail()

Posted: Thu Sep 27, 2012 4:02 pm
by kabuc
Thanks, name issue is solved.

PHP version: 5.3.10-1ubuntu3.2

It turns out that the staff and the customers do not always get the notifications, not only about new tickets, but also the answers. I was testing a lot. Ticket creates, but e-mail can not be sent. If I sent it to "email piping 'by email when cron runs, email notification not sent to clients / staff, but if I run manually hesk_pop3.php is entered into the browser address bar then sends Emails notification. I add in hesk_notifyCustomer function (email_functions.inc.php file), simple mail () function that sent to my e-mail additional notification, and is the same situation as the press themselves before mentioned, if run hesk_pop3.php file in browser - I get two notifications (one from hesk and one from my mail (), if during cron job is not getting any the notifications. I think I still have get 1 empty(subject,message) notification from my mail() when runs cron?

Re: Email piping and simple email from mail()

Posted: Thu Sep 27, 2012 4:59 pm
by Klemen
Perhaps when running Cron the script is run under root user that doesn't have mail() command configured properly?

Try using SMTP server instead and see if that works for you. Make sure you use the same email address for sending via SMTP as email address you have set as "From email" in settings.

Re: Email piping and simple email from mail()

Posted: Thu Sep 27, 2012 5:48 pm
by kabuc
Using pop3 use only on email piping to get email to ticket? Or uses to send staff answer notification emails too?

Re: Email piping and simple email from mail()

Posted: Fri Sep 28, 2012 12:15 pm
by Klemen
On the settings page Email tab look above where it says "Send email using:"

You probably have "PHP Mail()"? Use "SMTP Server" instead and enter your account details for the email you are using.

Re: Email piping and simple email from mail()

Posted: Mon Oct 01, 2012 5:00 pm
by kabuc
Klemen wrote:On the settings page Email tab look above where it says "Send email using:"

You probably have "PHP Mail()"? Use "SMTP Server" instead and enter your account details for the email you are using.
I dony no whats wrong. using php mail() - emails don't send, using smtp - emails send, but php mail() works well , but not on email piping

Re: Email piping and simple email from mail()

Posted: Tue Oct 02, 2012 8:32 am
by Klemen
This is because when using Cron or Email piping your server runs PHP under a different user, probably "root". And probably something is wrong with either mail() setup for root user or some email sending permissions are wrong.

To debug that you would need root access to the server and check PHP logs, Exim logs etc.

Re: Email piping and simple email from mail()

Posted: Tue Oct 02, 2012 8:36 am
by Klemen
To confirm that create a simple PHP mail script for testing and run it as cron job:

Code: Select all

#!/usr/bin/php -q
<?php
mail('you@youraddress.com', 'Test email from Cron', 'This is a test message');
echo "Email sent!";
?>
If the test email doesn't arrive when you set this script to run as a cron job, then problem is most likely PHP configuration for root.

If the test email does arrive, then the root users probably doesn't have permission to send mail with "From:" being set to your email address (check exim logs for "Sender verify failed").

Re: Email piping and simple email from mail()

Posted: Fri Oct 05, 2012 5:01 pm
by kabuc
Klemen wrote:Can you let me know what version of PHP are you running?

Also, please try this:

1. open file inc/pipe_functions.inc.php in a text/html editor
2. find

Code: Select all

$tmpvar['name'] = hesk_input($results['from'][0]['name']) or $tmpvar['name'] = $hesklang['pde'];
3. instead of that code use

Code: Select all

if ( empty($results['from'][0]['name']) )
{
	$tmpvar['name'] = $hesklang['pde'];
}
else
{
	$tmpvar['name'] = $results['from'][0]['name'];
	if (! empty($results['subject_encoding']) && strtoupper($results['subject_encoding']) != 'UTF-8' )
	{
		$tmpvar['name'] = iconv($results['subject_encoding'], 'UTF-8', $tmpvar['name']);
	}
}
4. save, upload and test.

Does this help with the name issue?
sometimes cuts end of the name, if original name is "Nick Dėrius" after email piping name is "Nick D", I just noticed that happens only with "ė" letter, cuts everything after this letter and this letter.

Re: Email piping and simple email from mail()

Posted: Sat Oct 06, 2012 9:05 am
by Klemen
This probably means the email client doesn't encode client name properly - for example encoding says it's ISO-8859-13 but that character is actually in a different encoding and PHP iconv function stops.

If you forward an email with this problem to my pop3test address I can check to confirm.

Re: Email piping and simple email from mail()

Posted: Sat Oct 06, 2012 12:21 pm
by kabuc
Klemen wrote:This probably means the email client doesn't encode client name properly - for example encoding says it's ISO-8859-13 but that character is actually in a different encoding and PHP iconv function stops.

If you forward an email with this problem to my pop3test address I can check to confirm.
I do not have the chance to do it because the emails are from customers.

Re: Email piping and simple email from mail()

Posted: Mon Oct 15, 2012 8:12 pm
by kabuc
I find that need use setlocale if using iconv. its true, perhaps it correct the problem?
http://stackoverflow.com/questions/7931 ... -setlocale

Re: Email piping and simple email from mail()

Posted: Thu Oct 18, 2012 6:19 am
by Klemen
I'm not sure how that would help in your case, but feel free to try it.

My best guess still is that the emails aren't properly encoded, but unfortunately I can't be sure or test it unless I see them.

Re: Email piping and simple email from mail()

Posted: Thu Oct 18, 2012 4:06 pm
by kabuc
Klemen wrote:I'm not sure how that would help in your case, but feel free to try it.

My best guess still is that the emails aren't properly encoded, but unfortunately I can't be sure or test it unless I see them.
How I can test it self what is encoded? because I can't send clients email