Ask coding questions

← Back to all posts
Why won't the php mail() function work?
TSelden (15)

The mail() function for PHP doesn't seem to work. No matter what I try. I can't figure out why. Does anybody know? Thanks in advance!

Answered by Baconman321 (1104) [earned 5 cycles]
View Answer
Comments
hotnewtop
TSelden (15)

It gives me this error as well (in an alternative editor): sh: 1: /usr/sbin/sendmail: not found. I think this means that the sendmail package isn't installed. I think that I need to install the sendmail package, although I don't know how to do that on repl.it, and I'm not currently in a position where I can download another editor.

Baconman321 (1104)

@TSelden I have gotten this in my project, and it's because they either turned that option off in the php.ini file or blocked you from downloading. I have tried to download the package and it says you don't have root, so whoever set this up didn't add this. You can request this on feedback (https://repl.it/feedback). I tried using Node.js to mail (it works!). If this answers your question please mark it as the answer.

Baconman321 (1104)

@TSelden No problem! Hard to find a person like you who uses PHP as well as me these days! Keep on being great!

xmasboy (4)

I also do PHP and I would like to know how to make an emailer with [email protected]