While I would normally agree with Hal, that you should use the actual mail server name, there are some situations where you may not be able to do so:
1) You are in a team environment, and you need to use "localhost" because the same code is running on multiple development machines. In some cases you would have a local mail server available that handles real mail, and you would use this. However, if your normal mail server is off-site and therefore only accessed over the public internet, you might not be able to perform mail relay without a previous POP operation that authenticated the connection.
2) You are running the code on a web host where you don't know the name of the actual machine (or it may change when the host moves things around without you knowing). Case in point: I recently received a notice that all code posting mail to mail.<mywebsite>.com must be changed to use "localhost" instead.
Your circumstances may require the use of "localhost". Part of your problem might be that the receiving email server (AOL) is not allowing the mail in because it might not think that the caller (your machine) is a valid mail server, so it regards the mail relay attempt as bogus. Here is where Hal's suggestion does apply. You might need to try a "real" mail server to see if that is the problem.
Peter
-------------------------
Work smarter, not harder