3

since we had no mail server. whether it is possible to use any mail server freely to send email using php mailer. say some of free mail servers to use for my purpose

Mohan Ram
  • 8,345
  • 25
  • 81
  • 130
  • 1
    If this relates to your [other question about using an arbitrary sender address](http://stackoverflow.com/questions/4518900/how-to-hide-sender-email-address-using-phpmailer), you **really** need to mention that here, as it makes a big difference to the options available. If it doesn't, apologies. Regardless, though, the clearer you are about your requirements, the better the answers you'll get and the less time people will waste giving you answers that won't work for you. – T.J. Crowder Jan 03 '11 at 12:40

4 Answers4

2

You can use Gmail like this:

<?php
require("class.phpmailer.php");
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'ssl://smtp.gmail.com:465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'fake[ @ ] googlemail.com';  // Change this to your gmail adress
$mailer->Password = 'fakepassword';  // Change this to your gmail password
$mailer->From = 'fake[ @ ] googlemail.com';  // This HAVE TO be your gmail adress
$mailer->FromName = 'fake'; // This is the from name in the email, you can put anything you like here
$mailer->Body = 'This is the main body of the email';
$mailer->Subject = 'This is the subject of the email';
$mailer->AddAddress('fake2[ @ ] gmail.com');  // This is where you put the email adress of the person you want to mail
if(!$mailer->Send())
{
   echo "Message was not sent<br/ >";
   echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
   echo "Message has been sent";
}
?>
Kimtho6
  • 6,154
  • 9
  • 40
  • 56
  • +1 but dont know why it doesnt work for me? This should work without any SMPT server of my own right? Any configurations to be made on WAMP? – Atif Jan 03 '11 at 12:50
  • `$mailer->Host` must be `$mailer->HostName` (works on my hosting server but still doesn't work on local server, I don't know what configurations to be made on WampServer) – Atif Jan 03 '11 at 12:55
1

I am using hMailServer on my home computer to test mail-related components. However, it requires you to have a mail server already. So I set up my GMail account to hMailServer and used it. Works perfectly for already 2 years.

http://www.hmailserver.com/

The only thing about GMail is that all emails sent out are in your GMail address.

mauris
  • 42,982
  • 15
  • 99
  • 131
0

Typically, no. Since this would be an obvious thing for spammers to use (see Wikpedia). You might well be able to use a mail server at your ISP, though.

The Archetypal Paul
  • 41,321
  • 20
  • 104
  • 134
0

There are a variety of free systems available (for instance, Google Apps for your Domain). These will have sending limits (Google's is 500 unique recipients per sending account, last I heard), and of course with a free service, you're very much subject to the whims of the organization supplying the service. Free services have a tendency to be run in a very hands-off and risk-averse fashion (naturally!), so anything out of the ordinary can get you shut down with very little (if any) recourse.

The next step up from free is cheap. I've had good results from a cheap service, in my case RunBox. I send via RunBox, receive via Google Apps (because of Google's excellent spam filtering), and it costs very little. And if I email them with a problem, they actually respond. This isn't meant as a specific endorsement of them (and I have no affiliation, other than being a client), just a note that sometimes paying just a little bit buys you a lot.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875