完全按网上的例子,[email protected],密码为password123
- C# code
if MyUtil_SMTP_Msg_Init()<0 then MessageBox('错误','发送邮件初始化失败!',StopSign!); returnend if if MyUtil_SMTP_Msg_SetInfo(1,1,[email protected]')<0 then MessageBox('错误','发送邮件地址设置失败!',StopSign!); returnend if if MyUtil_SMTP_Msg_SetInfo(1,2,'user_test')<0 then MessageBox('错误','发件人设置失败!',StopSign!); returnend if if MyUtil_SMTP_Msg_SetInfo(2,1,[email protected]')<0 then MessageBox('错误','收件人设置失败!',StopSign!); returnend if if MyUtil_SMTP_Msg_SetInfo(3,1,"主题!")<0 then MessageBox('错误','主题设置失败!',StopSign!); returnend if if MyUtil_SMTP_Msg_SetInfo(5,1,"这是邮件的正文!")<0 then MessageBox('错误','正文设置失败!',StopSign!); returnend if if MyUtil_SMTP_Connect('smtp.163.com',25,'user_test','password123')<0 then MessageBox('错误','连接失败!',StopSign!); returnend if if MyUtil_SMTP_Msg_Send()<0 then MessageBox('错误','发送失败!',StopSign!); returnend if if MyUtil_SMTP_Disconnect()<0 then MessageBox('错误','断开连接失败!',StopSign!); returnend if
执行时,到MyUtil_SMTP_Connect这会返回-1,出错。不知道connect的设置哪里错了。
我用outlook配置试了下,配置时必须把"我的服务器要求身份验证"勾上才能发邮件。不知道mymail要如何调用。
------解决方案--------------------
现在一些主流的邮件服务器已经不支持非专用邮件软件的接入,MYMAIL适用自己搭建的企业邮件服务器
------解决方案--------------------
你看一下 163上的设置是否支持客户端方式