Jump to content
xisto Community
veerumits

In Php- How To Send Mail From Localhost To Web Mail Server Mail is Compulsary now a days

Recommended Posts

I want to know what configuration changes are required in Local machine to use mail (); function in Localhost to delivered on internet.
1) There are compulsory to install and configure mail server on Localhost to use mail (); ?
2) I have installed WAMP 5 in my localhost machine any change in WAMP configuration file also need to use mail (); ?
3) POP3, MIME, etc also required ?
4) Any more information to complete this task please welcome?
5) Overall my aim is to use mail() in WAMP5 and it should be delivered. OK.
I read in the web page that :
The mail() function allows you to send emails directly from a script.
This function returns TRUE if the email was successfully accepted for delivery, otherwise it returns FALSE.
Syntax
mail(to,subject,message,headers,parameters)

Parameter Description
to Required. Specifies the receiver / receivers of the email
subject Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters
message Required. Defines the message to be sent. Each line should be separated with a LF (\n). Lines should not exceed 70 characters.
Windows note: If a full stop is found on the beginning of a line in the message, it might be removed. To solve this problem, replace the full stop with a double dot:

<?php$txt = str_replace("\n.", "\n..", $txt);
?>

headers Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n).
Note: When sending an email, it must contain a From header. This can be set with this parameter or in the php.ini file.
parameters Optional. Specifies an additional parameter to the sendmail program (the one defined in the sendmail_path configuration setting). (i.e. this can be used to set the envelope sender address when using sendmail with the -f sendmail option)

Web page also have sample Example:

<?php$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// More headers
$headers .= 'From: <webmaster@example.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";
mail($to,$subject,$message,$headers);
?>

I make changes as where needed but my mail is not delivered,
So please anybody could help how to we success in delivering mail from my local WAMP5 to On Internet.
Thanks

Share this post


Link to post
Share on other sites

A couple of years ago i was in the same situation as you, the solution to this problem is to use a SMTP server on your local machine. This SMTP server will be in charge of sending all the emails that your php script will send with the mail() function.

You can use the SMTP server that comes with any Windows Operating System since Windows 2000 Pro or you can use any other SMTP server.

At first you can think that the SMTP server that comes with Windows is the best choice, but my experience with this server was very bad because it is not easy to configure as you may think, so i suggest you to do not use it, instead you can use any other SMTP server that you want.

The SMTP Server that i use at that moment was ArGoSoft Mail Server version 1.8.8.8 which was free for personal use and provides the service for three standard Internet protocols: SMTP, POP3 and Finger, it was very easy to install, configure and use, and i can say that it works very well. The new version of ArGoSoft Mail Server is version 1.8.9.6 and it is still free, as usual this new version corrects bugs and some other things.

For more information and all the details related please visit the ArGoSoft Mail Server page. Also, i recommend you to view the details of the new mail server offered by its creators called ArGoSoft Mail Server .NET!, and then decide which one you will use.

Best regards,

Share this post


Link to post
Share on other sites
Does not respondIn Php- How To Send Mail From Localhost To Web Mail Server

I performed all the steps mentioned above but it takes too long time to execute the file.After this line execution stops..And mail is also not delivered.

$mail = $smtp->send($to, $headers, $body);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.