Jump to content

Recommended Posts

hi


when i execute a mail program iam getting some error as follows

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\appserv\www\mails.php on line 20

what is the solution to this problem

code

<?php
// Target email address.
$to="webmaster@localhost";

// Your subject.
$subject="Test Email";

// Sender. You may put the sender's email address after "from:". This example file use "info@phpsimple.net"
$mail_from="from: info@phpsimple.net \n";
// Set this email to HTML email format.
$mail_from .="Content-Type: text/html; charset=utf-8 \n";

// Your message.
$message="Hello, This is your test email.<br>
Your email server is working now!
";

// Send email.
$sentmail = mail($to,$subject,$message,$mail_from);

// If your email succesfully sent.
if($sentmail){
echo "Email has been sent.";
}
else {
echo "Cannot send email.";
}
?>


thanks
mrjameer
Link to comment
https://forums.phpfreaks.com/topic/19277-php-mail/
Share on other sites

If you are running this on your personal computer, you need to install a mail server.  If this is running on a site hosted by someone else, they don't have a mailserver installed or configured correctly.

If this is your own computer, I suggest: http://www.postcastserver.com/
Link to comment
https://forums.phpfreaks.com/topic/19277-php-mail/#findComment-83607
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.