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 = "me@mydomain.com";

	$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("to@whoever.com","subject","message",$headers,"-f".$from);

Link to comment
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.