I have be reading more and more about email spoofing and was curious how some things are done.

I know in PHP you can simply do mail() and then include "From: spoofsender@provider.com" for example, but how would you spoof the whole header?

Info such as sending IP address for example etc.



Modifying headers can be done like this:

$headers = "From: <$email> \n"; 
$headers .= "X-Sender: <$from>\n";
$headers .= "X-Mailer: PHP\n";

But if you want very detailed information on headers, check this out... http://kb.mediatemple.net/questions/892/Understanding+an+email+header

EDIT: Keep in mind that spoofing your headers will highly decrease the chances of your email arriving to the user inbox, if you are unlucky, it won't even show on the receiver's spam folder.

  • Thanks for the quick reply, with my testing I haven't gotten that to work with the integrated mail function. – Alrik May 5 '14 at 23:33
  • Could you give an example of code that would send an email to receiver@provider.com from sender@provider.com using the mail() function that is in PHP With the subject "Sending Subject" the text "Email Text" and from the IP Thanks! – Alrik May 5 '14 at 23:34
  • I believe that to be able to spoof a source IP address you need a spoofed server/network. I imagine that talking about hacking or spoofing is not allowed on this site. Can't help you past my answer sorry. – Alex Cavazos May 5 '14 at 23:37
  • I see, because I was going then ask how email verification would work? – Alrik May 5 '14 at 23:39
  • I read somewhere that they check if the senders IP matched the sending domain, but if users are able to spoof the sending IP then I don't see how this system would work as a hacker could just spoof the IP to the domains IP – Alrik May 5 '14 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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