Like many I seem to be having problems with mail().
If I try to send a simple message, it works, but it arrives from "root@myserver.myhost.com".
I tried to get around this by plugging in the userid and SMTP settings I use for my email account:
ini_set("sendmail_from","user@mywebsite.com");
ini_set("SMTP","myserver.myhost.com");
phpinfo(); // looks ok
mail("sometest@hotmail.com", "My Subject", "Line 1\nLine 2\nLine 3");
BUT this doesn't work.
Also, one thing I don't get about this is what about the password? When I set up an email account in my email software, I need to supply a userid and password. mail() doesn't seem to allow for this, but everyone (except me) seems to be using it successfully. Can someone fill me in on how this works?
Thanks.
mail() problem
Moderator: General Moderators
mail with the from
I don't quite know how this will fit in with your code but this should help solve that from problem.
phpScott
Code: Select all
<?php
mail ("you@here", "$subject", "$message", "From: <$sender>\n". "Reply-To: <$sender>\n");
?>ok, thanks, that seems to work, but...
if you do this and examine the email (properties/details/message source in Outlook Express), it's still coming from "root@myserver.myhost.com".
I'm thinking of putting together a mass-mailing application (no spam!), and I'm not sure if it's ok to have my host's root id associated with the message... ?
if you do this and examine the email (properties/details/message source in Outlook Express), it's still coming from "root@myserver.myhost.com".
I'm thinking of putting together a mass-mailing application (no spam!), and I'm not sure if it's ok to have my host's root id associated with the message... ?
I don't know
I have never encountered that problem before.
I use a very simillar script and when I looked at the header info in outlook I couldn't see anythin like that.
I will do some searching and see what I come up with.
go to http://www.php.net and do a search for mail.
It will come up with all sorts of info for you.
phpScott
I use a very simillar script and when I looked at the header info in outlook I couldn't see anythin like that.
I will do some searching and see what I come up with.
go to http://www.php.net and do a search for mail.
It will come up with all sorts of info for you.
phpScott
I use this script and guess what it works! So it should wor on yours too.
Then in Outlook it should say "From: Hi".
Code: Select all
<?php
mail("your_email_address","subject","message","From: Hi");
?>