Email piping and simple email from mail()

Helpdesk for my helpdesk software

Moderator: mkoch227

kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post 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))
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post 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?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post by kabuc »

Using pop3 use only on email piping to get email to ticket? Or uses to send staff answer notification emails too?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post 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
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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").
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post 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.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post 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.
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post by kabuc »

I find that need use setlocale if using iconv. its true, perhaps it correct the problem?
http://stackoverflow.com/questions/7931 ... -setlocale
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Email piping and simple email from mail()

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
kabuc
Posts: 69
Joined: Tue Jun 21, 2011 6:32 am

Re: Email piping and simple email from mail()

Post 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
Post Reply