hello Everyone,

I am trying to test PHP mail on my local host but to no avail. I have changed the SMTP in my php.ini file to that of my ISP. I have downloaded and installed both Mozilla's Thunderbird 3.0 as well as ArgoSoft MailServer free 1.0. I have Googled and Googled to cross reference teh various results I am getting. Thunderbird will not cooperate by insisting that it can't find the email settings (IMAP port =100, SMTP port =25 and email address = me@locahost), but according to a couple of results I found I didn't even need Thunderbird.

Help/suggestions/all that good stuff would be greatly appreciated. Thank you to all the knowledgeable people who respond to this.

Recommended Answers

All 9 Replies

Can you provide the code you are using to send the email?

Sure. Here is the PHP at the top of the page.

$to = 'webmaker@comcast.net';


//User info (DO NOT EDIT!)
$name = ($_POST['name']); //sender's name
$email = ($_POST['email']); //sender's email
$website = stripslashes($_POST['website']); //sender's website

//The subject
$subject  = "[LightFormX Contact Form] "; //The default subject. Will appear by default in all messages. Change this if you want.
$subject .= stripslashes($_POST['subject']); // the subject


//The message you will receive in your mailbox
//Each parts are commented to help you understand what it does exaclty.
//YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
$msg  = "From : $name \r\n";  //add sender's name to the message
$msg .= "e-Mail : $email \r\n";  //add sender's email to the message
$msg .= "Website : $website \r\n"; //add sender's website to the message
$msg .= "Subject : $subject \r\n\n"; //add subject to the message (optional! It will be displayed in the header anyway)
$msg .= "---Message--- \r\n".stripslashes($_POST['message'])."\r\n\n";  //the message itself

//Extras: User info (Optional!)
//Delete this part if you don't need it
//Display user information such as Ip address and browsers information...
$msg .= "---User information--- \r\n"; //Title
$msg .= "User IP : ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
$msg .= "Browser info : ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
$msg .= "User come from : ".$_SERVER["HTTP_REFERER"]; //Referrer

Here is the PHP within the form

<?php
   if ($_SERVER['REQUEST_METHOD'] != 'POST'){
      $self = $_SERVER['PHP_SELF'];
?>
	    <!-- Start HTML form -->
   	<form name="form" method="post" id="third" action="<?php echo $self;?>"  class="niceform">

and here is the rest

<?php
	} else {
        error_reporting(0);

      	if  (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))

	  	//Message sent!
	  	//It the message that will be displayed when the user click the sumbit button
	  	//You can modify the text if you want
      	echo nl2br("
	   	<div class=\"MsgSent\">
		<h1>Praise the Lord!</h1>
			<p><strong><?$name;?></strong>, your message has been sent!<br /> You will receive correspondence as soon as possible.</p>
		</div>
	   ");

       	else

	    // Display error message if the message failed to send
        echo "
	   	<div class=\"MsgError\">
			<p>Sorry <b><?=$name;?></b>, your message failed to send. Please, try again later.</p>
		</div>";
	}
?>

Check Alex's youtube Video on mailing.
BTW Alex have done good Job in PHP/MYSQL

Ok the code looks fine so most likely it's the smtp configuration on your web server.

SMTP is pretty straight forward when developing on your home system.
Unfortunately I do not have much experience with Thunderbird and the Mail Server product you mentioned.

However generally speaking you do not need a mail server, but only need to define the Mail Server Name in your PHP INI file.
Your Mail Server is mail.comcast.net.
If you want to test connectivity you can go to a command line and type the following
telnet mail.comcast.net 25 <enter>
you should connect, but don't hang around to long they may not like it :)


Are you receiving any error messages such as "Unable to Relay"?

The old mail function bug. The smtp only works if you have a localhost mail server. The reason, there is no password provided anywhere for php to read so access is denied to the remote smtp although you could try the imap_mail() function to see if it makes a difference. Alternatively I have heard in the past there are some scripts that provide custom mail functions which will allow such a smtp request.

The old mail function bug. The smtp only works if you have a localhost mail server. The reason, there is no password provided anywhere for php to read so access is denied to the remote smtp although you could try the imap_mail() function to see if it makes a difference. Alternatively I have heard in the past there are some scripts that provide custom mail functions which will allow such a smtp request.

Soory for hijacking thread for a minute. Does this allow gmail thing+local wamp server. It would be cool playing wth e-mail related PHP without "true" server

Soory for hijacking thread for a minute. Does this allow gmail thing+local wamp server. It would be cool playing wth e-mail related PHP without "true" server

If you are talking about using the google server to send mail without having any mail server installed well that is possible with the help of a custom mail script/class you can download. Now don't get me banned by hijacking a thread...

If you are talking about using the google server to send mail without having any mail server installed well that is possible with the help of a custom mail script/class you can download. Now don't get me banned by hijacking a thread...

This last time, bear with me guys. I would like to know where to download such a script or the keywords for google et al. Then Back to the thread's owner: Did the suggestions above helped you?

Yes, thank you. I will try the suggestions that have been posted and see what happens. I will come back later with an update.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.