0

Before I go on I just want to say that I know this is a duplicate question, but every answer I have seen hasn't worked for me.

Basically I have a php script that I am using to send an email to users who have forgotten their password. The code looks like this: mail("user@domain.co", "testing", "test");

I am using localhost which I know can be a problem with this sort of thing but I have a postfix server installed which should be fixing things. When I check my mail logs the server does indeed appear to have tried to send the mail, however its status shows up as bounced and the email is never delivered (not even in spam). Does anyone know what might be happening?

Heres what shows up in the log: Aug 13 10:14:31 kali postfix/error[3079]: 0E61F9DB8F: to=address@gmail.com, relay=none, delay=2.3, delays=2.2/0/0/0.06, dsn=5.0.0, status=bounced (gmail.com)

The postconf output is way to long to show, sorry.

Gamaray
  • 68
  • 1
  • 8
  • Please show relevant postfix log and `postconf` output – Johannes H. Aug 12 '21 at 22:34
  • 1
    Question can be reopened once MTA logs are provided, and it turns out more of a programming than a ServerFault question. – mario Aug 12 '21 at 22:39
  • I agree with closing but would suggest "Should be moved to SF" intead of guessing a duplicate without any info if the problem is actually the same. – Johannes H. Aug 12 '21 at 22:40
  • Heres what shows up in the log: Aug 13 10:14:31 kali postfix/error[3079]: 0E61F9DB8F: to=address@gmail.com, relay=none, delay=2.3, delays=2.2/0/0/0.06, dsn=5.0.0, status=bounced (gmail.com) – Gamaray Aug 13 '21 at 10:20
  • There should be more in the logs, not just that single line. Postfix should log when it receives the mail from PHP, it should log someting while talking to gmail, and it should also log the response code from gmail. If you don't see anything else referrign to that messages, please post your postfix settings. Either way this is likely an issue with your postfix configuration, not your code, so you should ask this on ServerFault (or SuperUser) – Johannes H. Aug 13 '21 at 12:29
  • Be aware though that sending messages from your own servers is not a trivial task. DNS and reverse DNS setup must be correct, SPF and DKIM should be configured and used correctly, your server must not appear on any blacklist, and a couple of more equirements. Id any are not met, most servers will reject your messages. – Johannes H. Aug 13 '21 at 12:31
  • To overcome those issues, configure your postifx to relay all messages through another SMTP server, for example the one you use for your own private email. Make sure the server will relay your email though, this might require login and using an email associated with your account with them as sender. – Johannes H. Aug 13 '21 at 12:33
  • So you want me to have postfix use a different SMTP server to relay my messages? I guess that would save a lot of time. Ok I'll give it a go, thanks. – Gamaray Aug 13 '21 at 12:41
  • That's the easiest solution. Self-Hosting SMTP is certainly possible though, just really annoying. Especially the initial setup. – Johannes H. Aug 13 '21 at 12:46

0 Answers0