Free Web Hosting Forum
(#1 (permalink))
Old
SGuiGGZ's Avatar
Junior Member
SGuiGGZ is on a distinguished road
 
Posts: 3
Join Date: Oct 2011
Location: Under your Bed
Exclamation Simple Email Test - 10-30-2011, 10:32 PM

After Many headaches trying to figure out how to get the mail() function in php working, I came up with his simple php script that sets the necessary ini-settings to get the email to actually send. Just replace the $email variable with your target email address, save the file to your site, and navigate to it from your browser.

It will say that it worked as long as the mail() feature is active on your server, but that doesn't mean that it sent. Due to server maintenance, workload, and a thousand other variables, it could take some time for the email to reach you. The longest amount of time I've seen is about 15 minutes, but they were performing mail server maintenance at the time.

This code tests good on server 48, please reply with your servers and whether or not it worked for you.

The code is as follows:

<html>
<head>
<title>PHP Email Test provided by TrentTechServices.com - We speak your language!</title>
</head>
<body>
<?php
$email = 'YourEmail@domain.com';

ini_set('SMTP','smtp.000webhost.com');

if(mail($email, "Email Test", "It Works!"))
{
echo 'Check your Inbox!';
}
else
{
echo 'mail() for PHP not working';
}
?>
</body>
</html>
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Member
Hans Henrik is on a distinguished road
 
Posts: 57
Join Date: Oct 2011
Location: Norway
Default 10-31-2011, 01:41 PM

i don't know why, but i never had to ini_set anything to get mail() to work
(just annoying is that the email arrives at hotmail like 2 minutes after running the function, and it gets in the junk mail)


to get my attention, send a private message
Reply With Quote
Reply

Tags
email, mail(), php, php mail (), webmail

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com