(ClOSED) Problem-emails failed

Moderator: crythias

Locked
bayerex
Znuny expert
Posts: 164
Joined: 03 Dec 2012, 00:30
Znuny Version: 3.2.7

(ClOSED) Problem-emails failed

Post by bayerex »

Hi all,

I have a very confusing problem I wish to share with you and hope someone has a suggestion/solution!

I once implemented something from a previous forum in order to block and email back unregistered customers using the following code:

/System/PostMaster/NewTicket.pm
Line 40

Code: Select all

##### First part of blocking unregistered customer email addresses  
    $Self->{EmailObject} = Kernel::System::Email->new(%Param);
##### end of change
LINE: 160

Code: Select all

##### if there is no customer user found!
    if ( !$GetParam{'X-OTRS-CustomerUser'} ) {
        $GetParam{'X-OTRS-CustomerUser'} = $GetParam{SenderEmailAddress};
        

      $Self->{LogObject}->Log( Priority => 'info', Message => "$_ not in database, rejecting and sending email" );
      
      # Send Agent an email to notify of blocked ticket
      $Self->{EmailObject}->Send(
         To         => $GetParam{SenderEmailAddress},
         From       => 'support@oursite.com',
         Subject    => "Nachricht wurde von unserem Server abgelehnt worden",
         Body       => "Dear Sir or Madame,\r\n\r\ndas Ticketsystem hat eine E-mail von Ihrer E-mail-Adresse ($GetParam{SenderEmailAddress}) empfangen. Before you can use our ticket system please register at our website http://support.oursite.com registrieren.\r\n.\r\n\r\nKind Regards\r\nYour Support-Team\r\nOur Company \r\nwww.oursite.com",
         Charset    => $Self->{ConfigObject}->Get('DefaultCharset'),
         MimeType   => 'text/plain',
         Loop       => 1,
         Attachment => [
            {
               Filename    => 'customer-email.txt',
               Content     => "Subject: $Param{GetParam}->{Subject}\r\nBody: $Param{GetParam}->{Body}",
               ContentType => 'application/octet-stream',
            }
         ],
      );
      return;
     }
##################### End of changes 
The problem is, until the user eventually registers they continue to receive the same rejection email every night at 00:10!! It seems to be coming from crontab running otrs.cleanup at this time.

If I run this script manually it states:
Starting OTRS PostMaster... (/opt/otrs//var/spool/problem-email-0675cc1fa6aa757c399f3ac294b191a6) failed.
After the customer has registered it then cleans up ok:
Starting OTRS PostMaster... (/opt/otrs//var/spool/problem-email-0675cc1fa6aa757c399f3ac294b191a6) (remove email) done.
Can anyone explain why it is behaving in this way and how I can ensure the customer is not repeatedly emailed back??

Many thanks in advance.
Last edited by bayerex on 28 Jul 2013, 17:51, edited 7 times in total.
Current Production Server (recently switched from Windows)
OTRS 3.2.7 on Ubuntu 12.04LTS 64bit
PHP 5.3.10-1ubuntu3.6
mysql Ver 14.14 Distrib 5.5.31

Previous Production Server:
Windows 2008
MySQL 5.1.51 Community Server
Strawberry Perl 5.12.3.0
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Problem-emails failed

Post by jojo »

due to your changes the postmaster process fails and creates the problem mail on disc. where it is picked up and tried to be resend.

revert your changes and the system will work as designed
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
bayerex
Znuny expert
Posts: 164
Joined: 03 Dec 2012, 00:30
Znuny Version: 3.2.7

Re: Problem-emails failed

Post by bayerex »

But I don't want to give up on this feature as it's very useful. I think a workaround would be just to run a crontab to delete the contents of /opt/otrs/var/spool
Current Production Server (recently switched from Windows)
OTRS 3.2.7 on Ubuntu 12.04LTS 64bit
PHP 5.3.10-1ubuntu3.6
mysql Ver 14.14 Distrib 5.5.31

Previous Production Server:
Windows 2008
MySQL 5.1.51 Community Server
Strawberry Perl 5.12.3.0
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Problem-emails failed

Post by jojo »

this might break other mails which need to be resend
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Locked