Link to home
Start Free TrialLog in
Avatar of altariamx2003
altariamx2003Flag for Mexico

asked on

mail() is not working on windows dedicated server with plesk

Im trying to send email using mail() function in my server but no matter what i do the mail is not sended and the page dont show me any error.

I made this little example to check whats is happening:
<?php
$msg = "prueba";
$sub = "test";
$head  = 'From: sales@pvtcloudlab.com';
if(mail("altaria@hotmail.com", $sub, $msg, $head))
{ print "mail sended"; }
else
{ print "mail not sended"; }
?>

Open in new window

http://pvtcloudlab.com/pruebamail.php"

But i still cannot send my mails,

I got  a Windows Dedicated Server with Plesk  from godaddy, and I know windows sucks but for this project I dont have any alternatives.

This is the configuration of my php: http://pvtcloudlab.com/phpinfo.php

Do I need to change something in my configuration???

Do I miss something else???

Best Regards

Carlos
SOLUTION
Avatar of Nicholas
Nicholas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of altariamx2003

ASKER

Hi Nicholas

The mail is not sended no matter what i do, this is happening just In my windows dedicated server ("f"#$%"#$ck windows by the way").

I try also with my personal mail on gmail.com and also with the domain of my work grupossc.com but no matter with domain do I try the email is not sended.

I try phpmailer with the same result, this a test with phpmailer http://pvtcloudlab.com/pruebamailer.php with the same results
<?php
        ini_set("include_path", "assets/plugins/phpmailer/");
        require("class.phpmailer.php");
        $mail = new PHPMailer();
		
        $mail->From     = 'sales@pvtcloudlab.com';
        $mail->FromName = 'test';
        $mail->AddAddress('carlos.alvarez@grupossc.com');

        $mail->WordWrap = 50;                              // set word wrap
        $mail->IsHTML(true);                               // send as HTML

        $mail->Subject  =  "prueba";

        $mail->Body     = 'test'; 


        $mail->AltBody  =  "Riepilogo settimanale dell'impianto: ";
        if ( $mail->Send()){
			print "mail was sended";
        }
		else { print "mail was not sended"; }


?>

Open in new window

Avatar of Nicholas
Nicholas

You need to know the error

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

Open in new window

let me add that code
done

It gives me this message: Message could not be sent.Mailer Error: Could not instantiate mail function.

Do you know what does mean?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I change your code for this:
if($mail->Send())
{  echo 'Sent.<br/>'; }
else
{ echo 'Not sent: <pre>'.print_r(error_get_last(), true).'</pre>'; }

Open in new window


and it gives me this message:
--------------------
Array
(
    [type] => 2
    [message] => mail(): SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.
    [file] => C:\Inetpub\vhosts\pvtcloudlab.com\httpdocs\assets\plugins\phpmailer\class.phpmailer.php
    [line] => 698
)
-----------------

Do you know what is happening????
Avatar of Dave Baldwin
Godaddy does not allow you to send email thru external servers.  It blocks all of the ports you might use.  Run 'phpinfo()' (below) and see what is listed for the SMTP server.
<php
phpinfo();
?>

Open in new window


Here's what phpinfo() shows on my older Godaddy Windows server.
sendmail_from	noreply@secureserver.net	noreply@secureserver.net
sendmail_path	no value	no value
SMTP	relay-hosting.secureserver.net	relay-hosting.secureserver.net
smtp_port	25	25

Open in new window

Hi Dave this the info that i got from phpinfo http://pvtcloudlab.com/phpinfo.php


sendmail_from      gerente@s166-62-103-236.secureserver.net      gerente@s166-62-103-236.secureserver.net
sendmail_path      no value      no value
SMTP      localhost      localhost
smtp_port      25      25
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the problem remains even with altaria@yahoo.com, perhaps as you say guys this a problem with the setup from godaddy, im gonna check on my server if there is something else that i need to change.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thx a lot for your time guys
i found the solution by myself