Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/services/cloudmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ def create_email(self, config: Dict[str, Any] = None) -> Dict[str, Any]:
"created_at": time.time(),
}

# 开个玩笑,还是要创建的,不然收不到验证码
self._create_email(email_address, password)

# 缓存邮箱信息
self._created_emails[email_address] = email_info
self.update_status(True)
Expand Down Expand Up @@ -514,6 +517,42 @@ def get_email_messages(self, email_id: str, **kwargs) -> List[Dict[str, Any]]:
logger.error(f"获取 Cloud Mail 邮件列表失败: {email_id} - {e}")
self.update_status(False, e)
return []

def _create_email(self, email_id: str, password: str) -> bool:
"""
添加邮箱用户

Args:
email_id: 邮箱地址
password: 邮箱密码

Returns:
创建状态
"""
try:
url_path = "/api/public/addUser"
payload = {
"list": [
{
"email": email_id,
"password": password
}
]
}

result = self._make_request("POST", url_path, json=payload)

if result.get("code") != 200:
logger.warning(f"创建邮箱失败: {result.get('message')}")
return False

self.update_status(True)
return True

except Exception as e:
logger.error(f"创建 Cloud Mail 邮箱失败: {email_id} - {e}")
self.update_status(False, e)
return False

def get_service_info(self) -> Dict[str, Any]:
"""获取服务信息"""
Expand Down
2 changes: 1 addition & 1 deletion static/js/email_services.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ async function handleAddCustom(e) {
domain: formData.get('fm_domain')
};
} else if (subType === 'cloudmail') {
serviceType = 'cloud_mail';
serviceType = 'cloudmail';
const domainInput = formData.get('cm_domain');
let domain = domainInput;
if (domainInput && domainInput.includes(',')) {
Expand Down