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.
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.
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:-
mail("firstname.lastname@example.org", "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 "email@example.com" too.
So how to I sort out sendmail, to get this email to "firstname.lastname@example.org" from "email@example.com"?
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?
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.