Create/Delete Space seperated folder names

25
April 16, 2019, at 10:50 AM

When I try to create a folder whose name is seperated by spaces it only takes the first word and ignores the second one. How do I solve this? I am writing with php to a dovecot sever. The space seperator given by LIST is "/".

The Code:

private const NEWLINE  = "\r\n";
private socket = fsockopen("ssl://testmail.com", 465, $errno, $errstr, 
20);
$foldername = "Hello World"
function createFolder($socket, $foldername) {
fputs($socket, "A3 Create " . $foldername . self::NEWLINE)
return read($socket);}
function read($socket)
{
stream_set_timeout($socket, 30);
$lines = [];
while(\FALSE !== ($line = fgets($socket))) {
    $lines[] = $line;
    if (\FALSE !== strpos($line, 'BAD')) {
        break;
    }
    if (\FALSE !== strpos($line, 'NO')) {
        break;
    }
    if (\FALSE !== strpos($line, 'OK')) {
        break;
    }
    if (\FALSE === strpos($line, 'OK')) {
        continue;
    }
}
return $lines;}

I have tried escaping strings and write it in a different way, but nothing seems to work. It does create a folder, but as mentioned above only with the first word. Server reply:

array(1) {[0]=>string(25) "A3 OK Create completed."}
Answer 1

Enclose it in quotes so that you send:

A4 CREATE "Folder Name"

PHP is not my language, but presumably, something like $foldername = '"Folder Name"' will get you what you want.

READ ALSO
Serverload using own postfix with mail() vs phpmailer with external smtp

Serverload using own postfix with mail() vs phpmailer with external smtp

I got a smaller VPS server at the moment ~20%-30% avg load 3 websitesClients need to send emails for order, registration, invoices and newsletter

37
ErrorException htmlspecialchars() expects parameter 1 to be string, array given

ErrorException htmlspecialchars() expects parameter 1 to be string, array given

I want to get data "report_to" from databaseBut i got error when I try to print variable in my view page

17