Reputation: 33
As you know there are a lot of websites (Just search on Google) that will send fake email(!), and sending fake email is really easy (As you know).
PHP Example:
$to = "[email protected]";
$from = "[email protected]";
$subject = "subject";
$message = "this is the message body";
$headers = "From: $from";
$ok = @mail($to, $subject, $message, $headers, "-f " . $from);
Is there anyway to set PHP with original server (domain) email, and How does Email service provider detect Email really sent from orginal domain or it is FAKE?
Upvotes: 0
Views: 66
Reputation: 5889
getmxrr()
if the domain in the e-mail address (so in your example from.com
) has a registered MX record in the DNS zone which will handle incoming and outgoing mails. Received: from[ip-address]
. You can check this against the MX record you got for the from.com
domain. If there are more than one Received: from
go with the last one.In theory you can check with this process if the e-mail sent to you really has been sent by the server which is managing the mails for the given domain.
In theory because: a spamer could work around that (e.x. with a hacked e-mail account). But then the spam sent out by this e-mail account should be relatively small because the e-mail provider will detect the spamer and block the e-mail account.
Upvotes: 0
Reputation: 2807
In your dns account you need to set your MX record pointing to your domain name.
Regarding your second question.
When an email is recieved, it might have a fake from address but the ip address of the server that sent the mail cannot be fake. There are many organisation and services providers that keep on updating their database for every spam email server that get notice of. Email service providers either own that service or use some other services providers to filter the emails. One famous organisation being spamhaus
.
I hope this helps you.
Upvotes: 1