PHP Mail()

nostradamus

New Member
Messages
10
Reaction score
0
Points
1
Hi, all. I'm a bit confused about PHP's mail() function. Can someone help me figure it out? I've a few questions.

I've read many tutorials about mail() already, and they still haven't been able to help me fully understand the process.

I'm running WAMP and am using localhost to test PHP scripts. From what I've heard of mail(), I need a mail server to send mails from scripts.

- I do not want to use my ISPs mail server.

- I want to be able to write out my mail() script, and send it off.

- Can I use AOL's mail server to send off mails from my scripts? If so, how is this done? What should I change in my php.ini file?

Thank you.
 

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
Don't believe that free hosting accounts can actually make changes to the php.ini file, not that you actually need to do this in order to send mail using the 'built in' php mail function. It's all quite painless code.
HTML:
<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Above Source From W3 Schools

What I will say however is that the x10 servers are a little 'quirky' depending upon other users demands throughout the day, but it has been getting better.. Sometimes email may take a long time to send or often not send at all.

A more reliable method is to use a mail Class script that will 'talk' to a more reliable email service like Gmail.. http://x10hosting.com/forums/tutorials/138791-email-mail-alternative.html and let them handle the mail for free.

You would need to read any documentation you can find for that link above to figure out if anybody has had it working with AOhell
 

nostradamus

New Member
Messages
10
Reaction score
0
Points
1
Thanks for your reply Cybrax.

I actually changed the SMTP section of the php.ini file to point to my web hosts mail server, but now I get this error when I try to execute my mail script:

Warning: mail() [function.mail]: SMTP server response: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) in...

From what I've read about this specific error message, I need authentication; apparently the mail server needs authentication for me to send mails by PHP.

- Is there a way to authenticate without using a program such a PEAR?
- How do I know if PEAR is already installed?
- How do I use PEAR to authenticate/send emails by PHP?

I am running a Windows Vista.

Thanks.
 

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
Sounds like improper setup of smtp settings for outgoing mail. error 550 = bad domain ?


Check you have authentication turned ON for the outgoing mail. Go into the advanced settings and for the outgoing server, and check "Outgoing server requires authentication, use same settings as incoming server" - that might cure it.
 

nostradamus

New Member
Messages
10
Reaction score
0
Points
1
Where is the advanced settings? Is it located in cpanel, because I see where it says Advanced Settings in the Email Authentication option, but it does not say anything about the outgoing server. There's no option to check something like that.
 
Top