Could not execute: /usr/sbin/sendmail

Status
Not open for further replies.

johnbagtas65

New Member
Messages
4
Reaction score
0
Points
0
Hi!
I have searched the forum for my problem, but I can't find an answer for my prob.
Maybe I haven't searched enough but my prob is simple..

I am using PHPmailer. and tried to send an email to my gmail account.
but i got this error:
Could not execute: /usr/sbin/sendmail


I am using gmail SMTP. can you enlighten me about this topic? Thank you!
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Do you have code we can look at? ( **** out passwords or other sensitive info).
Are you are saying that you are using SMTP through your Google Apps account?
 

johnbagtas65

New Member
Messages
4
Reaction score
0
Points
0
Code:
function emailsend($to,$from,$subject,$mensahe)
{
        
    try 
    {
        $mail = new PHPMailer(true); //New instance, with exceptions enabled

        //$body             = file_get_contents('contents.html');
        $body             = preg_replace('/\\\\/','', $mensahe); //Strip backslashes

        $mail->IsSMTP();                           // tell the class to use SMTP
        $mail->SMTPAuth   = true;                  // enable SMTP authentication
        $mail->Port       = 25;                    // set the SMTP server port
        $mail->Host       = "ssl://smtp.gmail.com"; // SMTP server
        $mail->Username   = "mymail@gmail.com";     // SMTP server username
        $mail->Password   = "mypassword";            // SMTP server password

        $mail->IsSendmail();  // tell the class to use Sendmail

        $mail->AddReplyTo("mymail@gmail.com","First Last");

        $mail->From       = "no_reply@ravenresort.co.nr";
        $mail->FromName   = "Admin Raven Resort";

        $tos = "$to";

        $mail->AddAddress($tos);

        $mail->Subject  = "$subject";

         $mail->AltBody    = "To view the message, please use an HTML  compatible email viewer!"; // optional, comment out and test
        $mail->WordWrap   = 80; // set word wrap

        $mail->MsgHTML($body);

        $mail->IsHTML(true); // send as HTML

        $mail->Send();
        //echo 'Message has been sent.';
    }
    catch (phpmailerException $e)
    {
        echo $e->errorMessage();
    }



}
This is my code. =[
In my other host, it works. But then when I transferred here at x10, it returned the error.
Im using Google's SMTP. I'm not sure if it's google app, but it's in my Gmail's settings. in the POP tab.
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
        $mail->IsSendmail();  // tell the class to use Sendmail

Remove that line and adjust/add:


Code:
    $mail->SMTPSecure = "ssl";  
    $mail->Host       = "smtp.gmail.com"; 
    $mail->Port       = 465;
 
Status
Not open for further replies.
Top