Ok,

This is most likely linux (Redhat 9) related, i'll give it a go anyway..

Setup:

Linux Redhat 9, connected to a router, assigned local IP.
Apache 2, PHP and MySLQ installed and running.

I'm sending a mail like this:


$subject = "Hello";
$msg4 = "Testmail";
$email = "info@whatever.com";

$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1\r\n";

$mailheaders .= "From: Graphical Solutions";

mail($email, $subject, $msg4, $mailheaders);

This seems to work, but not when sending to external e-mail addresses. The mail log (Redhat 9) says:

DSN: Data Format Error

though when i send the mail to myself locally, it arrives in my inbox.

Anything wrong with the script? I think the sendmail config on the Redhat box is pretty much standard. No alterations made.

I am really clueless since i'm a beginner at this Linux thing.

btw, my account resides at Demon, being www.graphicalsolutions.nl
when i do receive a mail, Outlook says:

From: Graphical.Solutions@localhost.localdomain to info@graphicalsolutions.nl

Is that ok?

Any help reaaally appreciated, i would like this thing to work!

thefisherman

    Whats your php version? Earlier versions may not have a fully working sendmail function.

    Also, Apache 2 is supposedly buggy with PHP, try reading up on other people with the same configuration (do a search on some forums)

      Though i can't tell you really how this works, it just does!

      $msg5="Some text";
      $to6=$email;
      $subject6="The subject";
      $sentbygs = "info@whatever.com";
      
      $mailheaders = "MIME-Version: 1.0\r\n";
      $mailheaders .= "Content-type: text/HTML; charset=ISO-8859-1\r\n";
      $mailheaders .= "From: whatever <info@whatever.com>\r\n";
      $subject6=stripslashes($subject6);
      
      @mail("$to6", $subject6, stripslashes($msg5), $mailheaders, "-f$sentbygs");
      

      Apparently sendmail seemed to have a problem with the data format, so i guess the addition to the @mail, -f$sentbygs, did the trick. The stripslashes doesn't do anything, coz there are none, neither in the subject or in the message itself. Maybe usefull if there are, i'm not sure..

      This piece of code i found on the net, as many others, though thusfar it's the only one that works!

      Thanks anyway for trying to help!

      thefisherman

        btw,

        there are quotes around the recipient variable, the "$to6", probably that helped as well.

        So for those who read this and have the same DSN Data Format Error, don't first try to alter your sendmail or hosts settings or whatever after a clean install of Redhat 9, try this first.

        thefisherman

          Write a Reply...