我正在尝试使用libcurl从我自己的电子邮件域发送电子邮件。 当我尝试使用libcurl发送电子邮件时,它说,登录被拒绝。
我的代码是,
* Rebuilt URL to: smtp://mail.mydomain.com:25/
* Hostname was NOT found in DNS cache
* Trying <My Ip address>...
* Connected to mail.mydomain.com (<email My ip address>) port 25 (#0)
< 220 mail.mydomain.com ESMTP
> EHLO client6
< 250-mail.mydomain.com
< 250-PIPELINING
< 250-SIZE 20480000
< 250-VRFY
< 250-ETRN
< 250-STARTTLS
< 250-AUTH PLAIN LOGIN
< 250-ENHANCEDSTATUSCODES
< 250-8BITMIME
< 250 DSN
> STARTTLS
< 220 2.0.0 Ready to start TLS
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* subject: C=IN; ST=Location; L=Tuty; O=My Company Ltd.; OU=IT; CN=Admin; emailAddress=admin@mydomain.com
* start date: 2011-06-16 06:27:18 GMT
* expire date: 2021-06-13 06:27:18 GMT
* issuer: C=IN; ST=Location; L=Tuty; O=My Company Ltd.; OU=IT; CN=Admin; emailAddress=admin@mydomain.com
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> EHLO client6
< 250-mail.mydomain.com
< 250-PIPELINING
< 250-SIZE 20480000
< 250-VRFY
< 250-ETRN
< 250-AUTH PLAIN LOGIN
< 250-ENHANCEDSTATUSCODES
< 250-8BITMIME
< 250 DSN
> AUTH LOGIN
< 334 VXNlcm5hbWU6
> cHBocnByb0BtYWlsLnBvcnRmb2xpb3ByaXNtLmNvbQ==
< 334 UGFzc3dvcmQ6
> cHBAcHBocnBybw==
< 535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
* Authentication failed: 535
* Closing connection 0
curl_easy_perform() failed: Login denied
我的输出是,
ssh myusername@mail.mydomain.com
所以我尝试使用终端中的ssh连接在我的电子邮件服务器中登录用户名。
def get_category_list(max_results=0 ,starts_with= ''):
cat_list = []
if starts_with:
cat_list = Category.objects.filter(name__startswith = starts_with)
else:
cat_list = Category.objects.all()
if max_results > 0:
if len(cat_list) > max_results:
cat_list = cat_list[:max_results]
'''for cat in cat_list:
cat.url = encode_url(cat.name)'''
return cat_list
def suggest_category(request):
cat_list =[]
starts_with = ''
if request.method == 'GET':
starts_with = request.GET['suggestion']
else:
starts_with = request.POST['suggestion']
cat_list = get_category_list(8, starts_with)
return render(request,"category_list.html",{'cat_list':cat_list})
它问我密码。当我提供我在libcurl代码中提到的相同密码时,它成功登录。
但是当我运行libcurl代码时,它表示登录被拒绝。