Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm getting 550 sender rejected by administrator" errors when sending mail through PHPs mail() with postfix on SUSE Linux. All mails appear in /var/mail/root but do not get delivered to the email address.

Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; linux.local
X-Postfix-Queue-ID: E5B86BA
X-Postfix-Sender: rfc822; wwwrun@linux.local
Arrival-Date: Wed, 12 Oct 2011 11:40:32 +0200 (CEST)

Final-Recipient: rfc822; myemail@domain.de
Action: failed
Status: 5.0.0
Remote-MTA: dns; mx01.kundenserver.de
Diagnostic-Code: smtp; 550 sender rejected by administrator

--E5B86BA.1318412433/linux.local
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <wwwrun@linux.local>
Received: by linux.local (Postfix, from userid 30)
    id E5B86BA; Wed, 12 Oct 2011 11:40:32 +0200 (CEST)
To: myemail@domain.de
Subject: Subject: test
X-PHP-Originating-Script: 0:mailtest.php
From: myemail@domain.de
Message-Id: <20111012094032.E5B86BA@linux.local>
Date: Wed, 12 Oct 2011 11:40:32 +0200 (CEST)

  test

I changed a week ago inet_interfaces in /etc/postfix/main.cf from localhost to all and could send mails through php. However it stopped working now.

~ # postconf -n
alias_maps = hash:/etc/aliases
biff = no
canonical_maps = hash:/etc/postfix/canonical
command_directory = /usr/sbin
config_directory = /etc/postfix
content_filter = 
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
defer_transports = 
delay_warning_time = 1h
disable_dns_lookups = no
disable_mime_output_conversion = no
html_directory = /usr/share/doc/packages/postfix-doc/html
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mail_spool_directory = /var/mail
mailbox_command = 
mailbox_size_limit = 0
mailbox_transport = 
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains = 
masquerade_exceptions = root
message_size_limit = 0
message_strip_characters = \0
mydestination = $myhostname, localhost.$mydomain
myhostname = linux.local
mynetworks_style = subnet
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/packages/postfix-doc/README_FILES
relay_domains = $mydestination, hash:/etc/postfix/relay
relayhost = 
relocated_maps = hash:/etc/postfix/relocated
sample_directory = /usr/share/doc/packages/postfix-doc/samples
sender_canonical_maps = hash:/etc/postfix/sender_canonical
sendmail_path = /usr/sbin/sendmail
setgid_group = maildrop
smtp_enforce_tls = no
smtp_sasl_auth_enable = no
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache
smtp_tls_session_cache_timeout = 3600s
smtp_use_tls = no
smtpd_client_restrictions = 
smtpd_helo_required = no
smtpd_helo_restrictions = 
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = no
smtpd_sender_restrictions = hash:/etc/postfix/access
smtpd_use_tls = no
strict_8bitmime = no
strict_rfc821_envelopes = no
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_alias_domains = hash:/etc/postfix/virtual
virtual_alias_maps = hash:/etc/postfix/virtual

For completeness I use this PHP script for testing sendmail:

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("myemail@domain.de", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailtest.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

share|improve this question
    
So what is the question here? 1and1 doesn't like your mail, so they reject it. Probably they don't like the invalid domain name! –  mailq Oct 12 '11 at 18:23
    
If you ever release this script to the public Internet then your ISP is going to kill you sooner or later. –  mailq Oct 12 '11 at 18:41
    
Do you mean "wwwrun@linux.local"? Postfix somewehere changes the real E-Mail adress to this. Thats the culprit. But how do I stop postfix from doing this? (And yes this "script" is only for testing purposes!) –  MarkusD Oct 24 '11 at 8:03
    
Sure. linux.local is not a valid domain name. Look in your configuration. It is obvious. –  mailq Oct 24 '11 at 8:06

1 Answer 1

up vote 0 down vote accepted

Change myhostname = linux.local to something useful. Your real existing(!) domain name would be acceptable.

share|improve this answer
    
This server hosts multiple domains and I can't change myhostname to a lot of domains can I? To clarify I need to send emails through php for separate domains but don't need mailboxes respectivly UNIX user accounts. The mail addresses already exist elsewhere. I have read postfix virtual readme but cannot make head or tail of it. –  MarkusD Oct 24 '11 at 8:57
    
@MarkusD The "HOWTO" part was not your question. You asked why your mails get rejected, and that is the answer. And no, you can't have multiple values in myhostname, because otherwise it would be named myhostnames. You always only have one(!) hostname. The "HOWTO" would be worth a new question, but will not be answered as this is no "HOWTO" site. –  mailq Oct 24 '11 at 12:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.