|
#1
|
|||
|
|||
|
Hello everyone,
I just switched to Hostgator a few weeks ago and tried my old sites on the server. I found just one thing that doesn't work for me: mail sending. I already read another thread about using phpmailer, but it didn't help me. I configured phpmailer like this: Code:
$mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "mail.domain.com"; // SMTP server $mail->SMTPDebug = 2; $mail->SMTPAuth = true; $mail->Host = "mail.domain.com"; $mail->Port = 26; server $mail->Username = "postmaster@domain.com"; // SMTP account username $mail->Password = "mypass"; // SMTP account password the value comes from mail accounts->configure mail client icon. I even tried with SMTP port 25. The message I got is: PHPMailer - SMTP basic test with authenticationSMTP -> FROM SERVER:220-gator778.hostgator.com ESMTP Exim 4.69 #1 Thu, 07 May 2009 11:00:06 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. SMTP -> FROM SERVER: 250-gator778.hostgator.com Hello www.domain.com SMTP -> FROM SERVER:250 OK SMTP -> FROM SERVER:250 Accepted SMTP -> FROM SERVER:354 Enter message, ending with "." on a line by itself SMTP -> FROM SERVER:250 OK id=1M2610-0008Gp-5W Message sent! What is this???? by the way this Code:
$body="asdkjhasdasd."; $to = "my@email.com"; $subject = "whatever"; mail($to,$subject,$body); please tell me what the problem is... Or if you could tell me how to send a simple email using mail(), I could modify it and use it for phpmailer. Thank you very much in advance. |
|
#2
|
|||
|
|||
|
The problem is the values it appears you are feeding phpMailer. "domain.com" should be your domain name. So in my case it would be:
PHP Code:
Hope that helps.
__________________
Kirkman-Enterprises.com |
|
#3
|
|||
|
|||
|
Where you see "domain.com" there is actually the real domain name I use. Let's call it mysite.com, or yoursite.com, or whatever. domain.com was just for writing something instead of putting blank spaces. The email address exists as well. I even tried it with 2 addresses out of the 250 addresses I have for the site.
I just changed the names everywhere because it is not my site, I just moved the code from another server. So, where "domain.com" is written there is in reality something else, but always the same name, say "mysite.com". (the site is not live yet and I don't want anyone to check it too soon )By the way shouldn't the simple mail() function work right as well? The strange thing is that I didn't see too many issues concerning email sending on Hostgator forums and here I am with a problem I could solve on 5 different servers until now... Can someone please put here a code snippet so I can see a very simple email sending code? Or just the "configuration" of the phpmailer code. I would like to see how it works and contact support if something is wrong about my settings. |
|
#4
|
||||
|
||||
|
try using the IP address of your server instead of the name, that's how I have it in the phpmailer instance I'm using...
Code:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "70.86.17.194";
$mail->SMTPAuth = true;
$mail->Username = "username";
$mail->Password = "password";
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->From = "email@domain.com";
$mail->FromName = "Email Name";
$mail->AddAddress("recipient@domain.com");
$mail->Subject = "Subject";
etc.
|
|
#5
|
|||
|
|||
|
You know, looking at your output, I'm not seeing an error message. I see the server responding OK and Accepted and phpMailer saying "Message Sent!" To turn off all the messages from being printed out you need to change this line:
PHP Code:
Now then, did you not get the email? Are you sending it to an email account at mysite.com/domain.com or to an e-mail account on another server? The other week I noticed an odd situation where sending e-mails to my GMail account from two different domains I run. I get the e-mails sent from one domain but not the other. On that other domain I don't get rejections in my mydomain.com email box and it doesn't turn up anywhere in my GMail account. (Weird.) After that, not sure what else to tell you. As for mail() not working, I can't say for sure with HostGator, but I know that the mail function gets turned off in a lot of places for security reasons. It can be trivial to abuse forms that are not secured on the back end to send spam out using the mail() function. Requiring us to send mail using some form of authentication reduces the chance of abuse. Again, I'm not sure if this is HostGator's reason or not, just what I've seen working with other organizations that run web servers.
__________________
Kirkman-Enterprises.com |
|
#6
|
|||
|
|||
|
Check your phplist documentation. I've never used phplist, but I'm guessing the only recognized values for "$mail->SMTPDebug" are true/false, or yes/no, or 1[any nonzero number]/0.
So the use of "2" - as far as PHP is concerned - is the same as "true", so you are running in debug mode; you're getting a "Succes" message but not sending an email. |
|
#7
|
|||
|
|||
|
I used the trick Pitrow wrote and now it's OK. I don't know what was the root of the problem, but it works now. Strange...
By the way I noticed that there are some email addresses I cannot send emails to, but this is the smallest problem now. The essential is that it is working. Thank you everyone for your help. Have a better day than I had yesterday
|
|
#8
|
|||
|
|||
|
Did anyone get this script to work from using PHP Mail function:
mail('sendto@someone.com', 'the subject', 'the message', null, '-fwebmaster@example.com'); where -f forces the return path to be webmaster@example.com. I could not get the return path to work. However, it will send emails but will not set the return path as webmaster@example.com. Any help is really appreciated. http://us2.php.net/manual/en/function.mail.php |
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mail() not sending mail in PHP script | icon | Shared Hosting Support | 18 | 08-22-2008 08:59 PM |
| Sending E-mail through Mail Client | Adorkable | Shared Hosting Support | 3 | 06-22-2008 04:04 AM |
| Mail sending error 421 | chickens | Network Status | 0 | 06-30-2005 03:34 PM |
All times are GMT -5. The time now is 01:32 PM.




)





