0

Deprecated: Function split() is deprecated in C:\xampp\htdocs\login_test\class.phpmailer.php on line 470
this error is coming from $mail->AddAddress(tester@hotmail.com); //is this same as To:

require_once('class.phpmailer.php');

                $mail = new PHPMailer();

                    $mail->AddAddress("test@hotmail.com"); //To:
                    $mail->Subject = "test1";

                    //html body
                    $body = "HEllow ikhlas";
                    $body .= "rest of boey";
                    $body .= "Sincerely,<br/>";
                    $body .= "test";

                    $mail->From = "test@hotmail.com";
                    $mail->FromName = "test";

                    if(!$mail->send())
                    {
                    echo "Mail error".$mail->ErrorInfo;
                    }
                    else
                    {
                    echo "worked";
                    }

Edited by hwoarang69

4
Contributors
17
Replies
19
Views
5 Years
Discussion Span
Last Post by hwoarang69
Featured Replies
  • 1

    Which PHPMailer version you are using?? It seems old. Try to download latest package from [http://phpmailer.worxware.com/](http://phpmailer.worxware.com/) Read More

  • 1

    Latest version is v5.2.0, you are using too older version which will not support latest PHP. Read More

  • 1
    diafol 3,720   5 Years Ago

    split - use explode() instead: $toArr = explode(',', $to); Read More

  • 1

    Becuse your email message body is not set, you can set it by: $mail->IsHTML(true); $mail->Body = $body; Read More

  • 1

    If you are working in local system, you need SMTP settings to send email. Either you can use SMTP credentials as shown [here](http://phpmailer.worxware.com/index.php?pg=examplebsmtp) OR you can use your own Gmail credentials as shown [here](http://phpmailer.worxware.com/index.php?pg=exampleagmail) Read More

0
  /**
   * Adds a "To" address.
   * @param string $address
   * @param string $name
   * @return void
   */


  function AddAddress($address, $name = '') {
    $cur = count($this->to);
    $this->to[$cur][0] = trim($address);
    $this->to[$cur][1] = $name;
  }

  ...
  line 470.
      $toArr = split(',', $to);

Edited by hwoarang69

0

4.1 just update to 5.2.0. (ops)

and how error is gone but i get this another error

Message body empty Mail error Message body empty

 if(!$mail->send())

is not working

Edited by hwoarang69

1

Latest version is v5.2.0, you are using too older version which will not support latest PHP.

Votes + Comments
works
0

just fix the body error.

know i get messaged worked

but when i the email is not there

just want to make sure.

$mail->From is the peron who is sending email
$mail->AddAddress is the person who is reserving the email.

Edited by hwoarang69

1

split - use explode() instead:

$toArr = explode(',', $to);
1

Becuse your email message body is not set, you can set it by:

$mail->IsHTML(true);
$mail->Body = $body;

Edited by vibhaJ

0

split - use explode() instead:

$toArr = explode(',', $to);

i had a old verson. i just update to new verson.
also changed
$mail->IsHTML(true);
$mail->Body = $body;

just fixed all the errors. its all working fine. i get messeage saying worked.
but the email is not being sent.

Edited by hwoarang69

1

If you are working in local system, you need SMTP settings to send email.

Either you can use SMTP credentials as shown here
OR you can use your own Gmail credentials as shown here

1

Have you got an smtp server set up? If not turn Mercury Mail on (comes with XAMPP). You may need to configure it though.

0

Have you got an smtp server set up? If not turn Mercury Mail on (comes with XAMPP). You may need to configure it though.

i think i have it config. do you mean i have go to mercy->configuration->mercuryS smtp->connection control-uncheck 1st box.

0

If you are working in local system, you need SMTP settings to send email.
Either you can use SMTP credentials as shown here
OR you can use your own Gmail credentials as shown here

do you mean put these in my code?

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "mail.yourdomain.com"; // sets the SMTP server
$mail->Port       = 26;

if yes than, how do i find Host? and Port?

and i dont have a domain.

Edited by hwoarang69

1

Once you go live and upload your site on live server it will send email as generally all server supports SMTP.
But if server is restricted, you have to give SMTP settings which will be given by your hosting providers.
Better if you have any live server, upload your test page on LIVE and then test.

0

ahh is there no way to do it without live pages?

Edited by hwoarang69

0

i have a gmail but do you know how can i find
$mail->host?
port number?

 $mail = new PHPMailer();
                    $mail->IsSMTP(); 
                    //$mail->Host = "test.gmail.com";
                    $mail->SMTPAuth = true;
                    $mail->SMTPSecure = "ssl";  //ssl or tls
                    $mail->Mailer = "smtp";
                    $mail->Host = "ssl://smtp.gmail.com";                           
                    $mail->Port = 465;              //set smtp port for the gmail
                    $mail->Username = "test@gmail.com";    //yourname@yourdomain
                    $mail->Password = "123456";     //password

Edited by hwoarang69

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.