Mail: jmail, system. net. Mail, system. Web. Mail

Source: Internet
Author: User
Tags email account mailmessage

I have been solving the problem of email garbled characters for the past two days. I have tried many methods and have no good solutions.

During the test, we used about three mailboxes, including Outlook, Hotmail, and Gmail. Generally, garbled characters are on Hotmail, And the charset is set to big5, in the text, the Chinese and English questions are mixed, and the Chinese characters are simplified and complex, so Hotmail is basically messy.

Start is sent with jmail, so change to UTF-8 or big5 are not good, not this mess, is another chaos ~

Then I heard that the systems used by other departments are not garbled. Later I found that the system was used. web. mail (this is already available in framework1.0, but the projects I have been using seem to have never done, and most of them have done system. net. mail, not implemented yet)

There is no big difference between moving and jmail. Here is only a few notes.
1. the email server may need to verify the correctness of the sender's address (I .e., from). The test email server does not seem to have checked this, so it is useful online, so it takes some twists and turns to check, then, you can spell the from statement as follows.

 

Code
Mailmessage. From =   " \ "" + Strmailfromname + " \ " < "   + Strmailfrom +   " > " ; // "\" John Smith \ "<you@yourcompany.com> ";
// Or
Mailmessage. From =   " XX@xxx.co " ; // The FROM address must exist in SMTP.

 

2. Other settings

Sample Code
System. Web. Mail. smtpmail. smtpserver = Strmailserver; // Mail. smtpserver;
Mailmessage. Fields. Add ( " Http://schemas.microsoft.com/cdo/configuration/sendusing " , " 2 " );
Mailmessage. Fields. Add ( " Http://schemas.microsoft.com/cdo/configuration/smtpauthenticate " , " 1 " );
// Email Password
Mailmessage. Fields. Add ( " Http://schemas.microsoft.com/cdo/configuration/sendpassword " , Strmailpassword ); // Mail. smtppassword );
// Email account
Mailmessage. Fields. Add ( " Http://schemas.microsoft.com/cdo/configuration/sendusername " , Strmailserverusername ); // Mail. smtpusername );
/*
* MSG. Fields. Add (" Http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout ", 60 );
* */

Here: sendusing is explained as follows, you can also see msnd (http://msdn.microsoft.com/en-us/library/aa566484.aspx)

Name Value Description

Cdosendusingpickup

1

Send the message by using the local SMTP service pickup directory.

Cdosendusingport

2

Send the message by using the Network (SMTP over the network ).

Cdosendusingexchange

3

Send the message by using the Microsoft Exchange mail submission Uniform Resource Identifier (URI). This URI is found in the user's urn: schemas: httpmail: sendmsg mailbox folder property.

Smtpauthenticate

Name Value Description

Cdoanonymous

0

Perform no authentication.

Cdobasic

1

Use the basic (clear text) authentication mechanic.

Cdontlm

2

Use the NTLM authentication mechanism.

Other mail components are also found.

W3jmail, jmail. Net (this is to add an advertisement at the end of the mail, which is annoying ~, No solution yet ~

System. net. Mail is also easy to use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.