orejano11-us28
New Member
- Messages
- 3
- Reaction score
- 0
- Points
- 0
Hi i'm new to this hosting, i'm learning php and need to send mails for a project but i can't send mail using php's mail() function
i tried using the code that descalzo posted in another thread
But it doesn't work for me
i set up a mail account to use with this script
also have selected Local Mail Exchanger in MX Entry in my CPanel
i'm sending mails to yahoo, spamavert and to my work accounts
i have tried using phpMailer and this other code
and had no luck either, so if someone could help me i will be very happy
Thanks and excuse my english
PS: i forgot to mention that the mails are getting out, i'm getting the "Mail delivery failed: returning message to sender" mails in my account inbox (in the domain main account)
i tried using the code that descalzo posted in another thread
Code:
<?php
// TEST OF THE MAIL SYSTEM USING PHP mail()
date_default_timezone_set('America/Los_Angeles');
echo date('l jS \of F Y h:i:s A');
echo "\n";
$from = "myX10cPanelName@myX10domain.x10.bz";
$to="myGMAILaccount@gmail.com";
$mailbody="Test message sent (PST): \n" . date('l jS \of F Y h:i:s A');
$subject="Test of PHP mail()" ;
$headers = "Content-type: text/plain; charset=windows-1251 \r\n";
$headers .= "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$resp = mail($to, $subject, $mailbody, $headers);
if( $resp ){
$outcome = "Mail sent" ;
} else {
$outcome = "Mail not sent";
}
print "\nThe mail system said: $outcome\n\n" ;
exit();
But it doesn't work for me
i set up a mail account to use with this script
also have selected Local Mail Exchanger in MX Entry in my CPanel
i'm sending mails to yahoo, spamavert and to my work accounts
i have tried using phpMailer and this other code
Code:
[COLOR=black]
require("PHPMailer_5.2.0/class.phpmailer.php");
$mail = new PHPMailer();
$mail->From = "your_emaila_ccount@your_domain.com";
$mail->FromName = "Admin";
$mail->AddAddress("examle@example.com"); // This is the adress to witch the email has to be send.
$mail->Subject = "An HTML Message";
$mail->IsHTML(true); // This tell's the PhPMailer that the messages uses HTML.
$mail->Body = "Hello, <b>my friend</b>! \n\n This message uses HTML !";
$mail->AltBody = "Dear Sir/Madam \n\n This message uses HTML, but your email client did not support it !";
if(!$mail->Send()) // Now we send the email and check if it was send or not.
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}[/COLOR]
and had no luck either, so if someone could help me i will be very happy
Thanks and excuse my english
PS: i forgot to mention that the mails are getting out, i'm getting the "Mail delivery failed: returning message to sender" mails in my account inbox (in the domain main account)
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pepe@spamavert.com
SMTP error from remote mail server after RCPT TO:<pepe@spamavert.com>:
host 10.33.251.248 [10.33.251.248]: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
------ This is a copy of the message, including all the headers. ------
Return-path: <jz@lotus.x10hosting.com>
Received: from jz by lotus.x10hosting.com with local (Exim 4.69)
(envelope-from <jz@lotus.x10hosting.com>)
id 1QwDYA-0005bu-GJ
for pepe@spamavert.com; Wed, 24 Aug 2011 09:31:22 -0400
To: pepe@spamavert.com
Subject: Test of PHP mail()
Content-type: text/plain; charset=windows-1251
From: webmaster@empresa.x10.mx
Reply-To: webmaster@empresa.x10.mx
MIME-Version: 1.0
X-Mailer: PHP/5.3.6
Message-Id: <E1QwDYA-0005bu-GJ@lotus.x10hosting.com>
Date: Wed, 24 Aug 2011 09:31:22 -0400
Test message sent (PST):
Wednesday 24th of August 2011 06:31:22 AM
Last edited: