Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Couldn't work out which section this question is best suited, so I've plumped for the general one. Please be gentle with me!...
Very simply I'm trying to send some mail using mail() in a PHP page. Typical sort of code like:-
<?PHP
mail("santa@claus.com", "Xmas", "when is it");
?>
I've got PHP running fine with apache, so that side of things is OK. I know I've got sendmail running from doing a 'ps', but not sure how it is configured and what I need to do to get it working with PHP/apache.
I'm using a dialup connection (I know, but I'm poor!) and my ISP which we'll call "dailup.org" for now. Assume I've got an email account with that ISP called "dave@dailup.org" too.
So how to I sort out sendmail, to get this email to "santa@claus.com" from "dave@dailup.org"?
Hopefully this is all easy for you geniuses out there! I've hunted around for tutorials and postings but not come up with anything particularly clear.
I'm just after a simple "get me going" sort of answer for now, thanks.
Go to www.php.net and look for the mail command on there. They have an example of what you are wanting to do.
There is a fourth argument you can pass called additional headers. In there you can set it so it looks like it came from someone other than you web server. I've done this in a couple of different php scripts without a problem.
There's a lot of postings on the "mail()" page on php.net! I couldn't really see anything which really explained how to use sendmail itself, rather lot of examples of PHP code, which I've got some grip on.
I did see one posting using a PEAR object which apparantly doesn't need sendmail, would that be a useful approach?
You probably need to take a look inside your php.ini file, usually in /usr/local/lib. Skip down to about line 510, at least that is where it shows up for me. This is the like you need to uncomment and modify to fit your system. In most set ups I've dealt with before using the suggested setting, on the line 509, was adequate.
After changing this setting you'll need to cycle your web server for the change to become effective. That's all there is to it, pretty simple on *NIX, different for WIN32.
I edited php.ini to change the mail settings so it looked at sendmail, and #ed out the Win32 related lines; but this still doesn't do anything.
How do I find out what sendmail is actually doing? It just seems to running in the background (I see when I do a 'ps'), but is there anywhere I can look to see if it is sending emails out, or receiving information to do so?
Also note that the DS option should be set to the value your ISP tells you to put as SMPT (outg going mail) server in your mail client's (like outlook)
I tried that, but it seems the -v option is for the version of mail, not the verbose mode. I looked at mail's option list but couldn't see a verbose option.
I assume there are very different versions of mail around.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.