Sending an email using mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Sending an email using mail()

Post by aceconcepts »

Hi,

I have used mail() plenty of times before and it has worked fine.

I am using it now and it works very well except for one domain (my own email address).

It is a 'contact us' form I have made and I have sent test messages to various email accounts and it works well except for my own domain.

I have got onto my email maintenance people and they have asked:

"Do you know how the emails are sent out, is it mapped to a SMTP account, or IMAP etc…"

Here is the code for sending the message:

Code: Select all

$to = "nick@q2q.co.uk";
		$subject = "Message from Q2Q web site";
		$message = $guestMsg;
		//CHECK GUEST CONTACT PREFERENCE
			if($guestByTel==1)
			{
				$message .= "<br /><br /><span style=\"font-weight:bold;\">" . $guestName . " has made a request to be contacted by telephone.</span>";
			}
		$from = $guestEmail;
		$headers = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
		$headers .= "Content-Transfer-Encoding: 7bit\r\n";
		$headers .= "From: " . $from . "\r\n";
		$headers .= "Reply-To: " . $from . "\r\n";
		mail($to,$subject,$message,$headers);
Any ideas/suggestions?
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

Maybe you need to read the bounce-back message. It should be located on your server.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Sending an email using mail()

Post by superdezign »

aceconcepts wrote:Any ideas/suggestions?
My suggestion = Swiftmailer.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Try setting the Return Path header.
Post Reply