•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,144 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,140 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1480 | Replies: 7
![]() |
•
•
Join Date: Apr 2007
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
How can i make this script work?
It is meant to send an email to a person with a confirmation code, but it is not working. whats wrong with it?
It is meant to send an email to a person with a confirmation code, but it is not working. whats wrong with it?
<?php
function send_mail($fromname,$frommail,$to,$subject,$body,$priority)
{
$fullmail = "\"$fromname\"<$frommail>";
$headers = "From: $fullmail\n";
$headers .= "X-Sender: $fullmail\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: $priority\n";
$headers .= "Return-path: $fullmail\n";
mail($to,$subject,$body,$headers);
}
function send_html_mail($fromname,$frommail,$to,$subject,$body,$priority)
{
$fullmail = "\"$fromname\"<$frommail>";
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= "From: $fullmail\n";
$headers .= "X-Sender: $fullmail\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: $priority\n";
$headers .= "Return-path: $fullmail\n";
mail($to,$subject,$body,$headers);
}
?>•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
What kind of error are you getting? The odds are the problem lies somewhere else in the code.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,879
Reputation:
Rep Power: 32
Solved Threads: 106
We can't debug unless we know what the problem is
The format for the output should be headers, then a single blank line, and then the message.
The format for the output should be headers, then a single blank line, and then the message. Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
You'll need to echo out some variables in your script to make sure you have the right information there and to make sure you are getting there at all.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
What OS is your server on?
Windows requires an SMTP server.
Windows requires an SMTP server.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Check first with your hosting company support and see if they have mail() set up properly. If they either you have a problem with your code or your mail may be blocked or added to spam.
You'll need to place some debugging into your code.
for starters:
[PHP]if (!mail(....)) {
echo 'Mail is not working... ';
}[/PHP]
mail() will return Boolean true or false if working or not respectively.
Set your error reporting to max:
[PHP]error_reporting(E_ALL);
ini_set('display_errors', 'true'); // not sure bout this one, I think thats the correct config option[/PHP]
Just try a simple mail() first.. don't use the abstraction function "send_mail".. just to test if its working.
Check if your hosting company's mail servers are not blacklisted.
Send emails to a few different addresses to make sure its not specific to an email address...
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
advertisment blog browser cell competition daniweb email encryption eu eudora firefox gentoo gmail google imap linux microsoft mobile mozilla news onecare open source opinion outlook penelope phishing phones php professional research scam security spam spammers spamming stocks technology thunderbird virus web webmail
- incorporating exchange access to a cron script (Shell Scripting)
- Error message when running ASP email script (ASP)
Other Threads in the PHP Forum
- Previous Thread: mysql_query(): supplied argument is not a valid MySQL-Link
- Next Thread: Execute file in server after window is closed



Linear Mode