Jump to content

php mail


suyesh.amatya

Recommended Posts

Add mail headers. Also I have sometimes had to use the -f switch (see mail() function) on certain web hosts

 

	$from = "[email protected]";

	$headers  = "MIME-Version: 1.0\n";
	$headers .= "Content-type: text/plain;\r\n";
	$headers .= "X-Priority: 3\n";
	$headers .= "X-MSMail-Priority: Normal\n";
	$headers .= "X-Mailer: php\n";
	$headers .= "From: \"My Company\" <".$from.">\n";
	$headers .= "Reply-To: \"My COmpany\" <".$from.">\n";

	mail("[email protected]","subject","message",$headers,"-f".$from);

Link to comment
https://forums.phpfreaks.com/topic/117485-php-mail/#findComment-604330
Share on other sites

Never tried from a standalone pc!

Always developed on *nix systems. Mail server would be sendmail or exim, etc..

 

Check out mail() on php.net

If you are a windows user:

The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket

 

http://uk2.php.net/manual/en/function.mail.php

Link to comment
https://forums.phpfreaks.com/topic/117485-php-mail/#findComment-604341
Share on other sites

You musn't have any MTA (mail transfer agent). See my post above. If you are using Outlook on your PC you have to setup a mail account i.e. POP3 suppliying a mail server, username, password, etc so you can send & receive mail.

The php mail function() cannot guess this for you!

Link to comment
https://forums.phpfreaks.com/topic/117485-php-mail/#findComment-604360
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.