[5.2.7] Class SMTP not found #113

Closed
M-Falken opened this Issue Sep 23, 2013 · 58 comments

Projects

None yet
@M-Falken

Hi
just test the very last 5.2.7 (#112 included) and got the error:
PHP Fatal error: Class 'SMTP' not found in ./lib/phpmailer/class.phpmailer.php on line 1147

But I have the PHPMailerAutoload.php on the directory, so I wonder what is wrong here, I've seen that now because of the autoload, the require class.smtp.php is gone so perhpas this is the issue.....some advice on this please ?

thanks
regards

@Synchro
Member
Synchro commented Sep 23, 2013

If the autoloader is loaded, it should be finding that class. I'd suggest setting a breakpoint in the autoloader to make sure it's being loaded.

@Synchro
Member
Synchro commented Oct 10, 2013

I suspect you are doing this:

require 'class.phpmailer.class.php';
$mail = new PHPMailer;

What you should be doing is:

require 'PHPMailerAutoload.php';
$mail = new PHPMailer;

The autoloader does not autoload itself, and it's not the PHPMailer class' job to load it.

@Synchro Synchro closed this Oct 10, 2013
@M-Falken

yes sadly forgot to make the changes in my files
Thanks

@tushe
tushe commented Oct 28, 2013

Hi, I have the same problem:

Fatal error: Class 'SMTP' not found in /home/nuoviamici.net/public_html/PHPMailer/class.phpmailer.php on line 1147

I did:

require 'PHPMailerAutoload.php';
$mail = new PHPMailer;

but it doesn't work...

@Synchro
Member
Synchro commented Oct 28, 2013

The autoloader depends on being in the same folder as the classes (as it is in the source) - is that the case for you?

@tushe
tushe commented Oct 28, 2013

Thanks for answer.
Yes, the autoloader is in the same folder of classes, I have this error:

Fatal error: Class 'PHPMailer' not found in /home/nuoviamici.net/public_html/inserisci_cliente.php on line 188

with:

require 'PHPMailerAutoload.php';
$mail = new PHPMailer;

@Synchro
Member
Synchro commented Oct 28, 2013

Set a breakpoint in the autoloader so you can check the paths it's looking in.

@tushe
tushe commented Oct 28, 2013

It works perfectly in my local webserver, the problem is when I transfer the website to remote webserver

@Synchro
Member
Synchro commented Oct 28, 2013

Do PHP versions match? Is the include_path set correctly/differently in your php.ini? If you can't set a breakpoint, write a small script that just loads PHPMailer and echoes paths from the autoloader.

@tushe
tushe commented Oct 28, 2013

Thanks, the hosting company's webserver has a old PHP version, i solved my problem!

@krishaa
krishaa commented Oct 29, 2013

hi Synchro, am also facing the same problem,
Fatal error: Class 'SMTP' not found in C:\Inetpub.....\beta\httpdocs\mailing\PHPMailer-master\class.phpmailer.php on line 1147

am new to this mail application. i don't know where to put that

require 'PHPMailerAutoload.php';
$mail = new PHPMailer;

can u pls help me in this......

@Synchro Synchro added a commit to Synchro/PHPMailer that referenced this issue Oct 29, 2013
@Synchro Synchro Provide fallback autoloading for old PHP versions, see #113 e26e978
@Synchro
Member
Synchro commented Oct 29, 2013

I've got a prospective solution for older PHP versions in my fork, linked above, that makes use of __autoload instead of the SPL autoloader. Please give that a go and see if it solves your problem.

@sam4444
sam4444 commented Oct 31, 2013

Hi Synchro,

I am changed that you say but my error not solve please visit this website contact form and see error and please given me solution.

http://codewavedeveloper.com/Contact_Us.php

i don't know what is PHP Version of my webserver. Please do needful for this.

@Synchro
Member
Synchro commented Oct 31, 2013

I can't do anything from outside and frankly your server is not my problem, and I'm not here to teach you PHP. You need to investigate yourself. You can always solve it manually by simply including the SMTP class.

@sam4444
sam4444 commented Nov 1, 2013

I have added all file uploaded on server with PHPMailer folder that is create problem to finding the SMTP class ?

you suggest require code like this:

require 'PHPMailerAutoload.php';
$mail = new PHPMailer;

In my file code is:

require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;

@Synchro
Member
Synchro commented Nov 1, 2013

That should work fine. The autoload function looks for the class files relative to its own location. If it's still not working, I can only think there is something wrong with your PHP installation; an old version, a badly-set include_path, wrong permissions etc. As I said before - set a breakpoint in the autoloader and see where it's looking. If you can't set a breakpoint, go and download Netbeans.

@sam4444
sam4444 commented Nov 1, 2013

below are the my web server php version: 5.2.17

@aljie
aljie commented Nov 7, 2013

Where can i get the version 0f 5.2.7? Thanks

@aljie
aljie commented Nov 7, 2013

I already downloaded PHPmailer_5.2.7 and change my code and use "include('PHPMailer-master/PHPMailerAutoload.php');" but still nothing sends.

@DarkViper

sometimes i got problems in class.phpmailer.php (v.5.2.7)
[575] require 'PHPMailerAutoload.php';
this statement tries to load from current working directory( or from PHP include path). But, it's not sure that in any case the working directory is identical to the directory where class.phpmailer.php is located.
[575] require dirname(FILE).DIRECTORY_SEPARATOR.'PHPMailerAutoload.php';
sets a clear definition which will work properly.
happy new year ;-)

@aljie
aljie commented Jan 2, 2014

Did you already have an answer with this @DarkViper or did you already fixed it? I already fixed mine and now its successfully running with the system.

@romaviv
romaviv commented Aug 18, 2014

To solve the issue: "Fatal error: Class 'SMTP' not found in..." in PHP versions 5.1.2 to 5.3.0 you only need to delete last parameter at

spl_autoload_register('PHPMailerAutoload', true, true);

and change it as follows:

spl_autoload_register('PHPMailerAutoload', true);

spl_autoload_register was introduced in PHP 5.1.2 but the third parameter of that function was introduced in PHP 5.3.0.

@Synchro
Member
Synchro commented Aug 22, 2014

The autoloader already takes this into account and does a version check.

@soundasleep soundasleep added a commit to soundasleep/openclerk that referenced this issue Sep 10, 2014
@soundasleep soundasleep update all Composer dependencies
fix "Class 'SMTP' not found" error with latest PHPmailer: PHPMailer/PHPMailer#113


git-svn-id: https://openclerk.googlecode.com/svn/trunk@1476 b12a1112-ca08-e5dd-f792-535eff3abf3b
05f313b
@StewartCraig

Hi Synchro

I am having a similar problem to those mentioned above. I am trying to use PHPMailer so that I can use AuthSMTP to send emails from my shopping cart (PhotoCart)

My web host (Dreamhost) constantly has it's mail servers blocked by hotmail and live.com and it has been suggested that I use authSMTP to prevent this from happening.

At the moment I get this error

Fatal error: Class 'SMTP' not found in /home/craigstew/photography-perth.com.au/Scripts/class.phpmailer.php on line 1194

I have seen some suggestions you made above but the errors shown above are different to mine so I am not certain if the solution is the same and either way, I am not sure where to put this additional code.

My web host shows this in regards to the version of PHP: PHP 5.4 x CGI

I would be very grateful for any assistance you could provide.

Sincerely

Craig Stewart

@Synchro
Member
Synchro commented Sep 16, 2014

Code? Are you loading the autoloader? Have you kept all the PHPMailer files together (as in the download)? Are you using the latest version?

@MissCP
MissCP commented Sep 16, 2014

Hi,
I'm getting the same too. The strange thing is the form works perfectly on my server but when it's used on the clients server the "Class 'SMTP' not found in..." error appears. I tend to assume it's being loaded because it works on the other server but are there any common problems with changing servers?
(I have not yet changed the email addresses and host over to their addresses)
Info:
PHP V 5.3
Files are contained in the same folder
smtp.php file states 'require 'PHPMailerAutoload.php';'
host set to mail.mywebsite.com

Hopefully you can shed some light on this for me :)
Thanks!

@StewartCraig

Hi Synchro

I was told that of all the files in the folder, the ones needed to be put on the server are the hi-lighted ones in the screen grab. Is this incorrect?

Yes they are all in the same location
screen shot 2014-09-16 at 5 54 26 pm

The version I am using was downloaded 2 weeks ago.

If by "Code?" you are referring to this statement that I made " I am not sure where to put this additional code." I am referring to your post above in this thread made on October 10, 2013.

Cheers

Craig

@Synchro
Member
Synchro commented Sep 16, 2014

The line number you're getting that error on does not line up with any of the last 3 releases, so I suspect you are using an old version. Please check the $Version property at the top of the PHPMailer class, and get the latest if it's not 5.2.8.

@StewartCraig

I have looked a the file highlighted on the right side, and on the left side is what I see when opening that file, which is the one that my Shopping cart is currently pointed at. Is this the correct file to look at. Sorry if my questions are very basic, I know very little about this subject. Just a small business owner who has to wear the I.T. hat.
screen shot 2014-09-16 at 6 22 24 pm

@Synchro
Member
Synchro commented Sep 16, 2014

OK, that looks good. Can you please post your code (don't post your passwords!)?

@Synchro
Member
Synchro commented Sep 16, 2014

I just had a thought - your shopping cart is probably loading class.phpmailer.php directly, and not loading the autoloader, and this means that the SMTP class is not loaded when it tries to use it. You should be able to fix that one of two ways: either alter your cart app to load the autoloader which will then be able to find the SMTP class, or load the SMTP class explicitly any time before PHPMailer gets used. If you can tell me the cart software you're using I can create a bug report for them to fix it, if they are doing it wrong.

@StewartCraig

Hi

Code… do you mean the file that was asked to create by AuthSMTP, and Dreamhost tutorial also has sample code which I have put below. I have not used this particular code, but did implement the version that AuthSMTP asked me to do to test that their set up would work. (it allows you to send a test email)

Problem with the Dreamhost code sample is that I do not know what to call the resultant file and I do not know where to put it.

Maybe this is the source of the problem?

    require("(location of files)/class.phpmailer.php");
    $mail = new PHPMailer();

    $mail->IsSMTP();                                      // set mailer to use SMTP
    $mail->Host = "localhost";  // specify main and backup server
    $mail->SMTPAuth = true;     // turn on SMTP authentication
    $mail->Username = "your_ssh_username";        // Make sure to replace this with your shell enabled user
    $mail->Password = "your_ssh_user_password";      // Make sure to use the proper password for your user


    $mail->From = "me@mydomain";
    $mail->FromName = "Your Name";
    $mail->AddAddress("recipient@theirdomain", "Their Name");
    $mail->AddCC("cc@ccdomain");
    $mail->AddBCC("bcc@bccdomain");

    $mail->AddReplyTo("me@mydomain", "me");

    $mail->WordWrap = 50;                                 // set word wrap to 50 characters
    $mail->IsHTML(true);                                  // set email format to HTML

    $mail->Subject = "PHPmailer example";
    $mail->Body    = "This is a test of email";

    if(!$mail->Send()){
    echo "Message could not be sent. <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;
    }
@StewartCraig

Woah…. Based on your last post I tried changing the path in my Shopping Cart, (which is called Photocart and is developed by Tim Grissett of PictruesPro.com) to point at the AutoLoader file, not the class.phpmailer.php file that I had been lead to believe was the correct thing before.

When I try to send a test mail from the Cart - it says it has been sent.

I am not getting them though. So, one problem solved, NEXT!

If the cart emails think that they are being sent, but they are not being received anywhere - what likely is the issue now?

Cheers

Craig

@Synchro
Member
Synchro commented Sep 17, 2014

By code I mean whatever code you are running that's not working!

Yes: this line is wrong:

require("(location of files)/class.phpmailer.php");

It should be:

require '(location of files)/PHPMailerAutoload.php';

Search for 'class.phpmailer.php' in your code and update any lines like that.

@Synchro
Member
Synchro commented Sep 17, 2014

If it's submitting but not arriving: check your spam folder in case it did really arrive, otherwise check your local mail server logs.

@StewartCraig

Hi

Well, Photocart thinks it is sending, but it is not arriving and it does not appear in the Maildir/New folder on my server which is where emails usually go to die. Looking at my AuthSMTP account, it shows that no emails have been sent though it either, and there should now be 3 from the test order that I just placed and the actual test email that I sent when setting it up in the first place.

I will have look at the test email code the AuthSMTP told me to try.

When you say search any "search my code and change any lines like that…."

I literally have no idea where to look… I presume not the files that I downloaded from your site

I guess that you must mean the coding of my actual cart software… but I would not have a clue where to start with that… it is a program that I purchased. I have contacted the developer though.

If you possibly have any other ideas, I would be very grateful for your continued help.

Thank you

Craig

@Synchro
Member
Synchro commented Sep 17, 2014

Yes, it will be within the app - if you point the developer at this ticket they will be able to fix it. It's possible that it's not checking send status and is failing silently for some reason. If you get your authsmtp test script working you can confirm it's not your server that's the problem.

@StewartCraig

Thanks, Marcus.

I am trying to get the AuthSMTP test script to work now.

previously nothing happened, but now at least I get a error message

Parse error: syntax error, unexpected 'require' (T_REQUIRE), expecting identifier (T_STRING) in /home/craigstew/photography-perth.com.au/Scripts/authsmtp-test.php on line 8

So I will contact AuthSMTP and see what they have to say about that, and I will contact Tim.

Thanks for your assistance, it is genuinely appreciated.

Craig

@Synchro
Member
Synchro commented Sep 17, 2014

You could just post the code here - that error is a simple syntax error, probably a mis-paste or something.

@StewartCraig

Hi Marcus

Thanks, I have also contacted AuthSMTP

The code is below, I have just blotted out my AuthSMTP account details.

the other change I made to change the port from 25 to 587, as I read on Dreamhosts' PHPMailer Tutorial that port 25 was specifically for Dreamhost mail servers whereas 587 was for connecting to any other mail server.

<?php
require("scripts/class.PHPMailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();    // set mailer to use SMTP
$mail->Host = "mail.authsmtp.com";    // specify main and backup server
$mail->SMTPAuth = true;    // turn on SMTP authentication
$mail->Username = "XXXXXXX";    // SMTP username -- CHANGE --
$mail->Password = "XXXXXXXX";    // SMTP password -- CHANGE --
$mail->Port = "587";    // SMTP Port

$mail->From = "info@blissstudio.com.au";    //From Address -- CHANGE --
$mail->FromName = "Bliss Studio";    //From Name -- CHANGE --
$mail->AddAddress("info@blissstudio.com.au", "Example");    //To Address -- CHANGE --
$mail->AddReplyTo("info@blissstudio.com.au", "Bliss Studio"); //Reply-To Address -- CHANGE --

$mail->WordWrap = 50;    // set word wrap to 50 characters
$mail->IsHTML(false);    // set email format to HTML

$mail->Subject = "AuthSMTP Test";
$mail->Body    = "AuthSMTP Test Message!";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";
?>
@Synchro
Member
Synchro commented Sep 17, 2014

OK, so this:

require("scripts/class.PHPMailer.php");

should be:

require 'scripts/PHPMailerAutoload.php';

Many file systems are case-sensitive, so their original line is also likely to fail since the actual file name is class.phpmailer.php. Aside from that it looks ok.

Port is an integer so it should be just 587 (which is the usual port for email submission), not "587". It's possible to support TLS on port 25 as well, though it's less common, but I can tell that authsmtp does use/support 587.

@StewartCraig

Ok, I made those changes and it give a new error. I just wanted to say, Marcus, I can sort this out with AuthSMTP, this does not seem to be your issue, while I do appreciate your help, I do not want to take advantage of it either.

Parse error: syntax error, unexpected '' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /home/craigstew/photography-perth.com.au/Scripts/authsmtp-test.php on line 8

@StewartCraig

Oh, just realised I uploaded the file with my user credentials still blotted out… I will try again

@Synchro
Member
Synchro commented Sep 17, 2014

You've still got some simple syntax error to cause that. Given that \ is used for namespace separators, could it be that you're running code with namespaces on PHP 5.2, which doesn't support them?

@StewartCraig

I get same error with user credentials…

My Web host shows that I am using PHP 5.4.

@Synchro
Member
Synchro commented Sep 17, 2014

Well, what's on line 8? Got to be something basic.

@StewartCraig

I will forward this to AuthSMTP and see what they make of it.

@StewartCraig

Hi Marcus.

I have heard from the Cart developer and he has given me the code that sends mail using PHPMailer.

Does anything jump out at you?

Craig

Here is the part of the code that sends email using PHPmailer that has worked for years. Perhaps it has changed since the file name has changed.

include_once("$smtp_phpmailer_url");

$mail = new PHPMailer();

$mail->IsSMTP();
$mail->Host = "$smtp_host";
$mail->SMTPAuth = true;
$mail->Username = "$smtp_username";
$mail->Password = "$smtp_password";

$mail->From = "$smtp_from";
$mail->FromName = "$smtp_from_name";
$mail->AddAddress("$smtp_to"); 
if($htmlMail == "1") { 
$mail->IsHTML(true);
} else {
$mail->IsHTML(false);
}
$mail->Subject = "$subject";

if($htmlMail == "1") {

$send_message = ""."";
$send_message .= $he['e_header'];
$send_message .= nl2br($message);
$send_message .= $he['e_footer'];
$message = $send_message;
}

$mail->Body = "$message";
$mail->Send();
@Synchro
Member
Synchro commented Sep 20, 2014

Well as this thread has said several times:

include_once("$smtp_phpmailer_url");

This needs to be pointing at the autoloader or the implementor needs to take responsibility for loading classes - in this case he's doing neither, so it's breaking. The way that PHPMailer was doing it before was just wrong, and made it difficult to override and subclass, primary objectives for a library.

@StewartCraig

Thanks Marcus,

I will pass this to Tim and see what he has to say.

It is difficult though, Tim says that the code as he has shown, has worked for years - something that he would know. You say that there are problems - something that you would know. It would seem that you and Tim are both correct and that the problem lays elsewhere.

When I point Photocart to The AutoLoader, photocart does seem to think that it is set up correctly but as mentioned above it thinks it sends a test email, but no emails are actually sent,

Is it possible that what Tim provided would have worked in the past but would now fail because of changes to PHPMailer - but it is "correct enough" that Photocart thinks it is actually working?

I know that there are people using PHPMailer with photocart successfully - one person I know tried very hard to assist me in this - and he is an experienced programmer with a PHP background (though it's not his specialty)

Cheers

Craig

@Synchro
Member
Synchro commented Sep 22, 2014

The previous behaviour was effectively a bug, since it was a hard-coded dependency on the SMTP class that was not possible to override. It could also interfere with autoloading mechanisms used by other frameworks that may have been including PHPMailer, for example Yii. This bug had been present for a long time, and in this case Photocart was relying on the buggy behaviour - now that it's been fixed (and now the SMTP class can be overridden), it's breaking. As mentioned many times above, the fix is to either take responsibility for loading classes yourself, or to use the provided autoloader. This is really trivial stuff; anyone with even the faintest clue about PHP will have no problem dealing with this.

Your messages not arriving is an entirely separate problem. You need to enable debug output, check your mail server logs, check your DNS, firewalls etc.

@Synchro
Member
Synchro commented Nov 13, 2014

Either your DNS is not working, or what you're connecting to has no DNS entry. Either way, it's not PHPMailer's problem, and don't hijack threads that are nothing to do with your question.

@CoAmA
CoAmA commented Feb 13, 2015

I have the following code:

require("PHPMailer-master/PHPMailerAutoload.php");

$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->Host     = "my.mx.server"; // SMTP server, i edited for security reasons it is introduced corectly
$mail->SMTPDebug  = 1;
$mail->SMTPAuth  = true;
$mail->SMTPSecure = "tls";
$mail->Username  = 'myname@mydomain.com';//i edited for security reasons it is introduced corectly
$mail->Password  = 'pass';//i edited for security reasons it are introduced corectly

$mail->From     = "myname@mydomain.com";//i edited for security reasons it is introduced corectly
$mail->AddAddress("alexandrubogdan.iatan@gmail.com");

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

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

but it prints the error:

2015-02-13 04:51:33 CLIENT -> SERVER: EHLO mydomain.com //i edited for security reasons,
the printed result is the same as my domain
2015-02-13 04:51:33 CLIENT -> SERVER: AUTH LOGIN 
2015-02-13 04:51:33 CLIENT -> SERVER: Y29hbWFAbWFuZXMtd29ya3Nob3Aud2ViYXR1LmNvbQ== 
2015-02-13 04:51:33 CLIENT -> SERVER: YnVuaWNhMg== 
2015-02-13 04:51:33 CLIENT -> SERVER: MAIL FROM: 
2015-02-13 04:51:33 CLIENT -> SERVER: RCPT TO: 
2015-02-13 04:51:33 SMTP ERROR: RCPT TO command failed: 554 5.7.1 : Relay access denied 
2015-02-13 04:51:33 CLIENT -> SERVER: QUIT 
2015-02-13 04:51:33 SMTP Error: The following recipients failed: alexandrubogdan.iatan@gmail.com

what am i doing wrong?
if it is not to much trouble can you help me?

@Synchro
Member
Synchro commented Feb 13, 2015
  • Use the latest PHPMailer - you're using an old version.
  • Follow the example code provided with PHPMailer (use the gmail example) - your code is missing parts and it's easier to start with good code than point out your problem.
  • Don't hijack threads.
@Markandeshwar

Hi Synchro,
I am using following code to send email... it is showing message sent but not receiving mail in inbox... other problem is after executing code i am getting email from gmail that your account has been blocked because sign-in attempt... please do needful in resolving this issue...

<?php
    require_once('PHPMailer\PHPMailerAutoload.php');
    $mail = new PHPMailer();  // create a new object
    $mail->IsSMTP(); // enable SMTP
    $mail->SMTPDebug = 0;  // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true;  // authentication enabled
    $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465; 
        $mail->Username = 'gmailid'; // i have written my gmail id as value
        $mail->Password = 'password'; // i have password of my mail id
    $mail->setFrom("x@x.com", "xyz");
    $mail->Subject = "test mail";
    $mail->Body = "hi";
    $mail->AddAddress("xyz@gmail.com");
    if(!$mail->Send()) {
        $error = 'Mail error: '.$mail->ErrorInfo; 
        echo "sent";
    } else {
        $error = 'Message sent!';
        echo $error;
    }
?>

Please suggest the solution for this if any....

@Synchro
Member
Synchro commented Apr 29, 2015
  • Don't hijack threads
  • Read the comments above
  • Read the readme
  • Use the gmail example provided
@meilmeili

hello synchro, i have a problem. I using a PHPMailer-master. but my SMTP doesnt connect. here my syntax

<?php
include('PHPmailer/class.phpmailer.php');
include ('PHPMailer/PHPMailerAutoload.php');
//phpinfo();
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host = "localhost"; // SMTP server
//IsSMTP(); // send via SMTP
$mail->Host     = "ssl://re.domain.co.id"; // SMTP server RE
$mail->Mailer   = "smtp";
$mail->SMTPAuth = false; // turn on SMTP authentication
$mail->SMTPSecure = 'ssl';
$mail->Port=25;

$mail->Username = "admin@re.domain.co.id"; // 
$mail->Password = "*******"; // SMTP password
$webmaster_email = "admin@re.domain.co.id"; //Please don't Reply to this email ID
$email = "recipient @ domian.co.id"; // Recipients email ID
$name = "Meilidyaningtyas C.R"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Admin System Online";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"namawebmaster");
$mail->WordWrap = 50; // set word wrap
$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Ini adalah permohonan no. project";
$mail->Body = "Ini adalah email contoh. harap untuk tidak membalas pesan ini."; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body 
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>

my problem is, fist, Fatal error: Class 'SMTP' not found in line 1149, then I solve it, and now I found Mailer Error: SMTP connect() failed. What should I do? please help me to solve this problem.

@Synchro
Member
Synchro commented May 4, 2015

Instead of posting the same questions over and over again, why don't you read the answers that are already here?

Just in case you bother to read this answer:

I'm locking this issue now - if you have a new question that is actually different to what has been covered here, open a new issue.

@Synchro Synchro locked and limited conversation to collaborators May 4, 2015
@Synchro Synchro unlocked this conversation May 4, 2015
@Synchro Synchro locked and limited conversation to collaborators May 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.