Jump to content

Is it must to have a mail server installed/configured to send mail with php mail


colap

Recommended Posts

<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

 

http://php.net/manual/en/function.mail.php

 

I have installed sendmail, do i have to configure it to send email with php email ?

 

How can i configure sendmail to send mail ?

You won't be able to send mail to the outside world without a valid domain. You might, but it will just go to trash.

 

If your simply wanting this for testing purposes I would recommend uninstalling sendmail and installing ssmtp. ssmtp will allow you to use a remote mail server such as that provided by your isp or Gmail to send mail. It is a drop in replacement for sendmail.

You won't be able to send mail to the outside world without a valid domain. You might, but it will just go to trash.

 

If your simply wanting this for testing purposes I would recommend uninstalling sendmail and installing ssmtp. ssmtp will allow you to use a remote mail server such as that provided by your isp or Gmail to send mail. It is a drop in replacement for sendmail.

 

How can i send email from my local pc ?

 

Suppose my local pc hostname has been set to "myhost.com" .

How can i send email from my local pc ?

 

For it to not go straight to the trash you will need a valid domain.

 

Suppose my local pc hostname has been set to "myhost.com"

 

hostnames and domain names are not the same thing.

Then use ssmtp to connect to (and use) that same mail server for testing.

 

I don't want to send email to gmail account only.

 

It should send email to any email address .

 

And the from address would be '[email protected]'

I never mentioned anything about sending mail to gmail only. I said, you could use gmail as your mail server if you wished.

No, the from address won't be '[email protected]' rather it would be '[email protected]'

I mean exactly what I said. You can use your own domain with Gmail.

 

http://www.google.com/apps/intl/en/group/index.html

 

Still confusion.

What will be the 'from' address to send email ?

Do i have to use the gmail address to send the email ?

 

Please elaborate/explain with example .

I'm not spoon feeding you. It's simple.

 

Gmail offers the ability to use there servers with your domain. When you send an email, it will come 'from' your domain via gmails mail servers.

So the 'from' address will be '[email protected]' , right ? And gmail server will act as a relay, right ?

Which mail server do you use ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.