Django:从Gmail发送邮件

时间:2016-03-24 22:00:19

标签: django email

我尝试从admin地址发送邮件:

我的观点:

EMAIL_USE_TLS = True
EMAIL_USE_SSL = True
EMAIL_HOST = 'smtp.gmail.com'
DEFAULT_FROM_EMAIL = "zor@gmail.com"
SERVER_EMAIL = "zor@gmail.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "zor@gmail.com"
EMAIL_HOST_PASSWORD = "mdp_of_zor@gmail.com"

ADMINS = [('Zorro', 'zor@gmail.com')]

我的设置:

SMTPAuthenticationError at /contact-admin

(534, '5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbsc\n5.7.14 aB9RwBxS9Q43rLo8piNoyzSjcewqxpgCnCkO6tyx-sse_8WkiANZHIGY3on1EP5iN9idsbA\n5.7.14 
xE5zrQPkaGzr_Xe585DeVpze3b3zOsKI6H18hXbwiBGvWclZ8CbmjRBu7RYFniGf2PbuIiq\n5.7.14 IMnCKmefwBzOk6OjtdwJ17m8zI76vD-xo8Z8Y7Baj3d1Xd54QekL593l-8fY5LG0xzWlP9\n5.7.14 54ZNmaiSaBEkpbV-l2RxUvDM5zyaJs> 
Please log in via your web browser and\n5.7.14 then try again.\n5.7.14  
Learn more at\n5.7.14  https://support.google.com/mail/answer/78754 198sm222847wml.22 - gsmtp')

但是当我想从这个视图发送邮件时,我有这个错误:

public class SequenceComparer<TElement> : Comparer<IEnumerable<TElement>>
{
    private readonly IComparer<TElement> _elementComparer;

    public SequenceComparer(IComparer<TElement> elementComparer = null)
    {
        _elementComparer = elementComparer ?? Comparer<TElement>.Default;
    }

    public override int Compare(IEnumerable<TElement> x, IEnumerable<TElement> y)
    {
        // Get enumerators to iterate over both sequences in sync.
        using (IEnumerator<TElement> xEnumerator = x.GetEnumerator())
        using (IEnumerator<TElement> yEnumerator = y.GetEnumerator())
        {
            // Advance both enumerators to their next element, 
            // until at least one passes the end of its sequence.
            bool xMove, yMove;
            while ((xMove = xEnumerator.MoveNext()) &&
                   (yMove = yEnumerator.MoveNext()))
            {
                // Compare the current pair of elements across the two sequences,
                // seeking element inequality.
                int elementComparison = _elementComparer.Compare(xEnumerator.Current, yEnumerator.Current);
                if (elementComparison != 0)
                    return elementComparison;
            }

            // Determine the relative length of the two sequences based on the final values of xMove and yMove.
            return xMove.CompareTo(yMove);
        }
    }
}

为什么我这个错误?

0 个答案:

没有答案