We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it soon. Read more about it: https://vestacp.com/docs/vesta-2-development
I can't used php for get all message in mail account as json from vesta cp
I can't used php for get all message in mail account as json from vesta cp
I used to php for get all massage in mail account as json from vesta cp but don't work it. How can I fix it ?
and other way by imap_open
Notice: Unknown: Can't connect to sev.cordrr.tk,143: Timed out (errflg=2) in Unknown on line 0
Code: Select all
<?php
// Server credentials
$vst_hostname = 'cordrr.tk';
$vst_username = 'admin';
$vst_password = 'YwoKFVYeNj';
$vst_command = 'v-list-mail-account';
// Account
$username = '[email protected]';
$domain = 'cordrr.tk';
$format = 'json';
// Prepare POST query
$postvars = array(
'user' => $vst_username,
'password' => $vst_password,
'cmd' => $vst_command,
'arg1' => $username,
'arg2' => $domain,
'arg3' => $format
);
$postdata = http_build_query($postvars);
// Send POST query via cURL
$postdata = http_build_query($postvars);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $vst_hostname . ':8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
// Parse JSON output
$data = json_decode($answer, true);
// Print result
print_r($data);
?>
Code: Select all
<?php
$imap = imap_open("{cordrr.tk:143/imap/tls}INBOX", "[email protected]", "admin");
$headers = imap_headers($imap);
if (!$headers) {
print "Failed to retrieve headers\n";
} else {
foreach($headers as $header) {
print "$header\n";
}
}
imap_close($imap);
?>