The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

sendmail (exim) failed to deliver

Discussion in 'E-mail Discussions' started by anstrom, Mar 2, 2004.

  1. anstrom

    anstrom Registered

    Joined:
    Feb 29, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I have a simple CGI script designed to deliever emails to about 200 addresses. A weird problem right now is that it failed to deliver to some of those addresses, and the bad thing is that it doesn't seemed to be related to the receiver's domain, i.e., one receiver sometimes can or can not receive my email, just randomly.

    I used to have my server on different machines, like Hsphere and other unix system, and none of them have similar problems, so I didn't expect it will be problem in Cpanel. I don't want to point finger here, but indeed it looks suspicious to me that Cpanel's sendmail program (exim) could be the reason. Some previous threads in this forum suggested a possible reverse DNS problem in the hosting machine could be the reason, but my current host manager assured me that it shouldn't be a problem.

    Here is a sendmail section in my Perl CGI code (simplified):

    ## start of sendmail loop
    {
    ## prepare sendmail command
    my $command = "/usr/sbin/sendmail -t << EOF
    From: $sender
    To: $email
    Subject: $subject

    $body
    EOF
    ";

    ## run sendmail
    system("$command >& /dev/null");
    if($?) {
    print "ERROR: $?\n";
    exit(1);
    }

    sleep 1; ## don't send too fast

    } ## end of sendmail loop
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    That's a bizarre way to do it, something like this as a straight replacement for the quoted text should work fine:

    Code:
    ## start of sendmail loop 
    {
    	open (MAIL, "|usr/sbin/sendmail -t");
    	print MAIL "From: $sender\n";
    	print MAIL "To: $email\n";
    	print MAIL "Subject: $subject\n\n";
    	print MAIL "$body\n";
    	close (MAIL);
    }
    
     
  3. anstrom

    anstrom Registered

    Joined:
    Feb 29, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Thanks very much, Jonathan. I agree that there is other way to do the same thing, and yes I have seen similar method to what you described here. I know my implementation works in other environments, but maybe it is not stable in Cpanel's jailshell. I will give your method a try.

    --Hongyu
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    I would suspect that Jailshell doesn't like the system() command. It might be worth reporting to cPanel in a ticket as Jailshell really ought to let you have access to the sendmail wrapper for exim.
     
Loading...

Share This Page