|
#1
|
|||
|
|||
|
I have a dedicated server with EV1 that I love and got a reseller account here to test scripts.
I seem to be having a problem with none of my scripts sending out mail using the mail() function. These work fine on my server, but just not on my hostgator account. Here is the basic of what I am doing. Variables are from an included config file and from $_post. Doesn't seem to have a problem grabbing the variables, just will not mail out. Server restriction perhaps? $subject = "$site_name Contact Us"; $message = "Name: $name\n\n"; $message .= "Comments: $comments\n\n"; $message .= "$site_url/\n"; $mailheaders = "From: $_post['email']";"; $mailheaders = "Reply-To: $_post['email']"; mail($site_email,$subject,$message,$mailheaders); |
|
#2
|
|||
|
|||
|
There is a limit to the numer of e-mails you can send out per hour, are you exceeding that limit?
Edit: Your code seems to be wrong, the syntax to mail() is mail ( $to, $subject, $message, $additional_headers, $additional_parameters) Are you sure $to ( in your case $site_email is your visitor's e-mail address)
__________________
http://www.theaquariumwiki.com/ Last edited by PsiPro; 04-16-2007 at 08:15 PM. |
|
#3
|
|||
|
|||
|
I also am having issues with this. I have had my mail script working on multiple sites I run on my reseller package for some time now, just recently it came to my attention that it was not working. Nothing has changed with the code in the time the script has been up. Also the script works fine on other servers not hosted with hostgator. As for exceeding my hourly limit for sending mail, this I believe is not the issue, at least not to my knowledge, I can send mail at any time with outlook, just not via the script. Has something changed on our servers? Is there a new suggested way to take care of this?
|
|
#4
|
|||
|
|||
|
Hi, and I have had an account for only 2 days, and I'm experiencing the same issues as described above. I find that IPB (2.2) is failing to send email messages, and I even verified this by sending myself an email through the forums. I haven't tried sending mail through an email account with roundcube yet, though.
|
|
#5
|
||||
|
||||
|
Here is how I did it.
$message = "This is the body of the email.\n\n"; $message .= "More body: probably a variable.\n"; $headers="From: someone@domain.com\r\n"; $subject = "This goes in the subject line of the email!!!"; $to_address = "email@mydomain.com"; $mailsend=mail("$to_address","$subject","$message" ,"$headers"); Works great for me. *BTW - I use my own postmaster email as the From field and include the visitors email inside the body of the message. If you try to use the visitors email address as part of the headers then it could be blocked by their SPF record. (I can only see this as forging an email header so I just don't do it, but a lot of script writers do.) Last edited by GatorJim; 06-18-2007 at 08:24 AM. |
|
#6
|
|||
|
|||
|
There are also problems with the following:
$mailheaders = "From: $_post['email']";"; $mailheaders = "Reply-To: $_post['email']"; It should read like this: $mailheaders = "From:" . $_post['email'] . "\r\n"; $mailheaders .= "Reply-To:" . $_post['email']; |
|
#7
|
|||
|
|||
|
Dear Friends,
I have a script in my website for sending feedback. It returns TRUE for mail() but it can't send email to receiver at all. Why? I have joomla nd drupal in my host but they work good and send emails successfully. ----------------------------------- My script is as following: $to = "admin@domain.org"; $sender = $_POST['email']; $headers = 'From:'.$sender."\r\n"; $headers .= 'MIME-Version: 1.0'."\n"; $headers .= 'Content-type: text/HTML; charset=utf-8'."\r\n"; $body = "<html><body style='font-family: Tahoma;'>".htmlspecialchars(nl2br($_POST['msg']))."<br><font color='#0000FF'>".$_POST['email']."</font></body></html>"; $send=mail($to, "WadiOnline News (Feedback) > ".$subject, $body, $headers); if($send){ echo 'Thanks for your feedback!'; } else { echo 'An Error happened in sending.'; } Waiting for your ehlp.
|
|
#8
|
|||
|
|||
|
This doesn't really help yalls' problems but at my old host, the mail never worked. It would work on other hosts, I got people to try it for me. But it would never send, though it returned true. I think it might have when I first went to them.
|
|
#9
|
|||
|
|||
|
Quote:
However as hostgator uses phpsuexec, where users' scripts are run as the user account the mail() functions works fine. |
|
#10
|
||||
|
||||
|
Rowshan-- try the simple case first. Remove the extra headers and large body, and just do a "Hello World" with the required parameters. Does that work?
__________________
Follow me on Twitter! http://twitter.com/mrw |
|
#11
|
|||
|
|||
|
Dear Friends,
Thanks! I check it with a small script as following but nothing: <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('admin@domain.org', 'My Subject', $message); ?> Maybe the problem is related to something else. drupal and joomla are using from mail() with header FROM. But they do that right. Why? Best Regards
__________________
Don't Forget the God in every thing! Emirates Newspepers (Dubai and Abu Dhabai) Headlines and Summary Ajman Forum, Humaid City, Marmmoka City, Emirates City |
|
#12
|
||||
|
||||
|
I copied / pasted this exact code to a .php file and it worked fine for me.
__________________
- David |
|
#13
|
|||
|
|||
|
So, Where is the problem?
I contacted to support Dep of hostgator and they said me: The issue here is that you are trying to send email from an email address that is not hosted on the server. Please change your script to not set a from address and the mail will send. But as you can see in the above script. It doesn't has FROM. Please help me. Thanks
__________________
Don't Forget the God in every thing! Emirates Newspepers (Dubai and Abu Dhabai) Headlines and Summary Ajman Forum, Humaid City, Marmmoka City, Emirates City Last edited by Rowshan; 07-17-2008 at 03:14 AM. |
|
#14
|
|||
|
|||
|
In my script, I had to change the path to the sendmail program to look like this:
Code:
$mailprog = '/usr/sbin/sendmail -i -t'; The -t was not present in the original version, and HG staff directed me to add it. |
|
#15
|
||||
|
||||
|
Did they see your new script? There's no from address being set at all. Tell them that.
__________________
Follow me on Twitter! http://twitter.com/mrw |
|
#16
|
|||
|
|||
|
I am having the same problem. I don't see an answer here.
My hello world. mail('tom@anotherdomain.com', 'hello world', 'hello world'); |
|
#17
|
|||
|
|||
|
Quote:
I realized that I was sending to a domain that I have set up hosting for, but have not moved over yet. I bet the DNS servers have the domain set up so the mail was not being sent to the correct place. When I changed the to address it worked fine. |
|
#18
|
|||
|
|||
|
Same problem. My awesome script:
$retval = mail("myaddress@example.com", "testsub from testmailer", "testmsg from testmailer", "From:anotheraddress@example.com\r\n"); echo $retval; It echoes 1. In this example, "anotheraddress@example.com" is a valid, functioning email address on the domain on which I'm running the script. Hostgator hosts it. |
|
#19
|
|||
|
|||
|
Hmm, looks like mail was down for a while. Changed nothing, now it's working. Hooray!
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -5. The time now is 01:30 PM.









