Jump to content

PHP mail again ? PLZ HELP


halm1985

Recommended Posts

Can somebody help me and tell me how sould my PHP settings be configured so that i become able to send E-mail messages from my site ( autmatic responses or scheduled messages ) ..

 

It is different on localhost from the site on the web ??? knowing that it's not wroking on both with me ..

 

 

Link to comment
https://forums.phpfreaks.com/topic/73174-php-mail-again-plz-help/
Share on other sites

Yeah, your good but I think -halm1985- is trying to use a FROM email address that is not associated with server at all. Could be the mail is being sent, but being sent to the recepients SPAM folder since the server email and FROM email do not match. 

 

No, i use a mail address under my domain, what problem could be there ?

 

Also my host supports SMTP and provided me with the corresonding server ??? i thought the problem is much simpler !!

 

Ther's an area in the php.ini file inlucdes :

 

[mail function]

; For Win32 only.

SMTP = localhost

smtp_port = 25

 

Will any configuration here be handy ??

 

What about php mailer ?? did anyone use it ?

That could be your problem on SMTP line. For example, mine uses:

 

SMTP = something.server.net

 

It will not accept = localhost

 

I cannot use "localhost" when connecting to server through a script either. I have to define the URL of the server. You can get this from your hosting control panel mail settings for SMTP.

 

If your server uses Sockets (SMTP) mail routine most commenly used is SMTP = mail.yoursite.com

These are my settings using PHPMAILER ..

 

I get the follwoing message on my browser :

 

Message was not sent.Mailer error: SMTP Error: The following recipients failed: [email protected] 

 

<?php

require("class.phpmailer.php");
$mail = new PHPMailer();

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "halal-loan.com"; // SMTP server
$mail->From = "[email protected]";
$mail->AddAddress("[email protected]");

$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

if(!$mail->Send())
{
   echo 'Message was not sent.';
   echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
   echo 'Message has been sent.';
}
?>

 

To add, when i change the name of the host i get another message

 

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\mail\class.smtp.php on line 105

 

Warning: fsockopen() [function.fsockopen]: unable to connect to halal-lsoan.com:25 (Unknown error) in C:\wamp\www\mail\class.smtp.php on line 105

Message was not sent.Mailer error: SMTP Error: Could not connect to SMTP host. 

 

So, i think the host name is correct ..

 

Plz help

Try this:

<?php

require("class.phpmailer.php");
$mail = new PHPMailer();

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.halal-loan.com"; // SMTP server
$mail->From = "[email protected]";
$mail->AddAddress("[email protected]");

$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;

if(!$mail->Send())
{
   echo "Message was not sent.";
   echo "Mailer error:" .$mail->ErrorInfo;
}
else
{
   echo "Message has been sent.";
}
?>

 

I added "mail." to HOST and changed single quotes to double in error messages. Also, make sure [email protected] is a real email address and notone from your catch all.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.