phpDeveloperForThesis
phpDeveloperForThesis

Reputation: 151

SMTP server response: 550 Invalid recipient to a simple email feature

i am creating a website using php that sends confirmation messages through emails..

to edit my php.ini, i followed this walkthrough:

http://php.net/manual/en/ref.mail.php

i downloaded a free smtp server to test the connections, i used port 25, and the DNS server as localhost. I use this server to test if the email i send is being connected

i used this simple code to test the mail() function:

<?php
$to = '[email protected]';
$subject = 'the subject';
$from = '[email protected]';
$message = 'hello';

if(mail($to, $subject, $message, "From: $from"))
  echo "Mail sent";
else
  echo "Mail send failure - message not sent"; ?>

when running, the smtp server indicates that the current active connection is the "[email protected]".

but the website shows this error message:

SMTP server response: 550 Invalid recipient

what should i do? i am very new to development and used smtp for the first time so i have no idea what is happening

PS. I got the smtp server here> softstack.com/freesmtp.html

Upvotes: 0

Views: 11730

Answers (2)

For testing you could try this tool, called Test Mail Server Tool, instead. It has the benefit of not sending actual emails thus spamming your account, but saving/opening the email on your desktop, the same email which would have been sent. You can examine the headers this way and debug more easily and much faster. Note that it's useless in production, and testing remotely. It was not meant for that.

Upvotes: 2

Naman Sharma
Naman Sharma

Reputation: 1

Remove $from in request header from inside quotes and try using a valid email address.

if(mail($to, $subject, $message, "From: " . $from))

Upvotes: 0

Related Questions