/    Sign up×
Community /Pin to ProfileBookmark

mail() function

I have php & apache setup on my mac at work (apache is shipped with os x 10.3.3)

I have a script that uses the mail function and it runs on my machien ([url]http://localhost/etc…[/url]) I run the script and it says the mail sent successfully ( based on if ( ! $mail ) test )
However I do not recieve the email I have sent to myself.

The code is fine, I’ve checked it several times, here it is for discussion sake:

<html>
<head>
<title>email test</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
</head>

<body bgcolor=”#FFFFFF” text=”#000000″>
<?php
$addr = “testaddress”;
$subject = “test”;
$string = “testing mail function”;
$mail = mail($addr, $subject, $string);

if (!$mail)
{ echo “mail function failed to process”; }
else
{ echo “mail function processed successfully”; }

?>
</body>
</html>

And yes “testaddress” lists the address and not the preceding string in the script.

If all that looks legit, then what is the problem here? could it be a setting in apache?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@JonaMar 10.2005 — [font=trebuchet ms]Check your PHP.ini file and make sure that "SMTP" is set to your outgoing SMTP mail server. Also make sure that your ISP does not block port 25 (usually this isn't the case, though).[/font]
Copy linkTweet thisAlerts:
@mitconMar 10.2005 — T-Wag:

Just some feedback...

I pasted your code into a PHP file on my website...

Changed the address ran it and it worked the first time. If you want to, send me an email address to hardcode and you can try it from my site.

You probably want to pursue Jona's line of thought, though.


Thought you might be interested,

Mitch
Copy linkTweet thisAlerts:
@T-WagauthorMar 10.2005 — Thanks Jona & mitcon, I'll definitly look into the php.ini issue and..hmm, the isp may be an issue but it should be resolve able by monday when our server consultant comes in and I can have him tweak what needs be tweaked should tweaking be in order.

mitcon, I'd appreciate it if you could try my email address, thanks. I'll PM it to you.
×

Success!

Help @T-Wag spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...