Jump to content

mail() on Linux


Recommended Posts

I am running a Linux server, and need the ability to send email with the mail() function as part of the site I am building on it. I know that the setup for mail is edited in php.ini, but am not sure what the proper setup is.

It will mainly be used for sending activation code emails, so it is necessary to use the mail() function.

Can someone give me some pointers on what I need to do?
Link to comment
Share on other sites

Have you already got a mail server available to you? If so, you'll only need to install and configure an MTA, I would recommend [url=http://ftp://ftp.debian.org/debian/pool/main/s/ssmtp/]ssmtp[/url] as its really easy to configure.

If you need to install a mailserver, its a much, much bigger job. You'll need to look at something like [url=http://www.postfix.org/]postfix[/url] but I'll tell you now, if your not a Linux sys admin, it will be a rather large learning curve.
Link to comment
Share on other sites

I asked the guy I bought it from about it, it has this "sendmail" program on it, but I don't know much about any of this stuff, so I don't know if I what I need to do...

Could you define "mailserver" for me? Once again, I dont know much about this, but what I have here is a server hosting my website and all I want to be able to do is use the mail() function in PHP to send activation code emails for registered users...
Link to comment
Share on other sites

Yes, using the:

[code]
$to = 'email@address.url';
$subject = 'subject'
$body = 'message'

mail($to, $subject, $body);
[/code]

Code format, and in php.ini:
[code]
[mail function]
sendmail_path = /usr/sbin/sendmail -t
sendmail_from = DO_NOT_REPLY@webaxiss.thathamkid.com
[/code]

With the php file:

[code]
<?php

$to      = 'wfabry@houston.rr.com';
$subject = 'TEST';
$message = 'test test test';

mail($to, $subject, $message);

header("Location:index.php");

?>
[/code]

So, anything wrong that could be stopping it from emailing?
Link to comment
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.