title: "imap could not open" - What is the path to my Sent folder?
body: <p>I send mails with PhpMailer, but I would like to save the mails in the "Sent" folder in my webmail and Outlook. I have a script but it could not open (imap_open) the file.</p>
  
  <p>What is the correct path?</p>
  
  <p>Here is the script:</p>
  
  <pre><code>&lt;?php
  require($_SERVER['DOCUMENT_ROOT'].'/admin/PHPMailer/class.phpmailer.php');
  require($_SERVER['DOCUMENT_ROOT'].'/adminPHPMailer/PHPMailerAutoload.php');
  
  class Mailer extends PHPMailer {
  
      public function copyToFolder($folderPath = null) {
          $message = $this-&gt;MIMEHeader . $this-&gt;MIMEBody;
          $path = "/." . (isset($folderPath) &amp;&amp; !is_null($folderPath) ? ".".$folderPath : ""); // Location to save the email
          //$imapStream = imap_open("{" . $this-&gt;Host . "}" . $path , $this-&gt;Username, $this-&gt;Password);
          $imapStream = imap_open("{" . $this-&gt;Host . "}" . $path ,"address@mydomain.com", "password");
  
          imap_append($imapStream, "{" . $this-&gt;Host . "}" . $path, $message);
          imap_close($imapStream);
      }
  }
  
  
  $mail = new Mailer();
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPAuth = true;     
  $mail-&gt;Host       = "localhost"; // sets the SMTP server
  $mail-&gt;Port       = 26;                    // set the SMTP port
  $mail-&gt;Username   = "address@mydomain.com"; // SMTP account username
  $mail-&gt;Password   = "password";        // SMTP account password 
  $mail-&gt;From = "address@mydomain.com";   
  $mail-&gt;FromName = "Don Joe";            
  $mail-&gt;AddAddress("to@gmail.com");
  $mail-&gt;WordWrap = 50;                               
  $mail-&gt;IsHTML(true);                                 
  $mail-&gt;Subject = "tárgy";
  $mail-&gt;Body    = $message;
  $mail-&gt;AltBody = $message;
  
  
  if(!$mail-&gt;Send())
  {
  
     echo "Message was not sent &lt;p&gt;";
     echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  
     exit;
  }else{
      $mail-&gt;copyToFolder(); // Will save into inbox
      $mail-&gt;copyToFolder("Sent"); // Will save into Sent folder
  }
  ?&gt;
  </code></pre>
  
  <p>My file struction on server:</p>
  
  <pre><code>0:/mail/mydomain.com/address/.Sent
  </code></pre>
  
  <p>My website:</p>
  
  <pre><code>0:/public_html/mydomain.com (this is root of my website under my domain)
  </code></pre>
  
  <p>My web client configuration:</p>
  
  <pre><code>Username:   address@mydomain.com
  Password :  password
  Incoming server:    mail.mydomain.com
  IMAP port: 143
  POP3 port: 110
  Outgoing server:    mail.mydomain.com
  SMTP port: 26
  </code></pre>
  
  <p>Error message:</p>
  
  <blockquote>
    <p>Warning: imap_open() [function.imap-open]: Couldn't open stream </p>
    
    <p>Warning: imap_append() expects parameter 1 to be resource, boolean given in</p>
    
    <p>Warning: imap_close() expects parameter 1 to be resource, boolean given in</p>
  </blockquote>