Jump to content

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


Recommended Posts

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\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 'no-reply@domain-of-mailserver.com'

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 'abc@gmail.com' rather it would be 'no-reply@domain-of-mailserver.com'

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 'mypcuseraccount@mypchomedomain.com' , right ? And gmail server will act as a relay, right ?

Which mail server do you use ?

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.