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 by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
v-add-mail-account script "like gmail"
-
- Posts: 1
- Joined: Thu Dec 26, 2019 7:15 am
- Os: CentOS 6x
- Web: apache + nginx
v-add-mail-account script "like gmail"
Hey.
Trying to create script "Create email account via php" like gmail (free emails on website).
But something not working (emails not created). Can someone help with this?
index.php:
Trying to create script "Create email account via php" like gmail (free emails on website).
But something not working (emails not created). Can someone help with this?
index.php:
testmail.php<html>
<head>
<meta charset="utf-8">
<title>blablabla</title>
</head>
<body>
<form action="testmail.php" method="post">
Username:<br>
<input type="text" name="username">
<br>
Email Address:<br>
<input type="email" name="email">
<br>
Password:<br>
<input type="password" name="password">
<br>
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>
<?php
// Server credentials
$vst_hostname = 'mywebsite.com';
$vst_username = 'myusername';
$vst_password = 'mypassword';
$vst_returncode = 'yes';
$vst_command = 'v-add-mail-account';
// New Account
$username = $_POST['username'];
$domain = 'mywebsite.com';
$acount = $_POST['email'];
$password = $_POST['password'];
// Prepare POST query
$postvars = array(
'user' => $vst_username,
'password' => $vst_password,
'returncode' => $vst_returncode,
'cmd' => $vst_command,
'arg1' => $username,
'arg2' => $domain,
'arg3' => $acount,
'arg4' => $password
);
$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);
// Check result
if($answer == 0) {
echo "User account has been successfuly created\n";
} else {
echo "Query returned error code: " .$answer. "\n";
}
?>
-
- Posts: 4
- Joined: Wed Jan 20, 2016 5:12 pm
Re: v-add-mail-account script "like gmail"
Could you solve the problem?