Use ESMTP (SMTP) for mail sending

Source: Internet
Author: User
When ESMTP/SMTP is used for mail sending, a problem occurs:
If the attachment is an image gif file, there is no problem with sending it. However, after receiving the message, the image cannot be displayed. Please kindly advise !!!!!
/*
* Created on 2004-12-21
*
* TODO To change the template for this generated file go
* Window-Preferences-Java-Code Style-Code Templates
*/
/**
* @ Author Administrator
*
* TODO To change the template for this generated type comment go
* Window-Preferences-Java-Code Style-Code Templates
*/
Public class FoxMailMain {
Public static void main (String [] args ){

FoxMail foxMail = new FoxMail ("smtp.citiz.net", 25 );
FoxMail. setMailUserName ("zhou ");
FoxMail. setMailUserPass ("abcdefg ");
FoxMail. setMailTo ("aaaaa@citiz.net ");
FoxMail. setMailFrom ("bbbb@citiz.net ");
FoxMail. setMailShowTo ("tom ");
FoxMail. setMailShowFrom ("Nike ");
FoxMail. setMailSubject ("hello Chinese topic ");
FoxMail. setMailBody ("welcome for you. mmm. Chinese ah. aaa uploads a line ");
FoxMail. setMailAttachFile (new String [] {"D: eclipse_projectworkspacePROJECT_emailsrcpic.gif "});

If (foxMail. sendMail ()){
System. out. println ("OK .");
} Else {
System. out. println ("False .");
}
}
}
FoxMail. java code
Import java. io. File;
Import java. io. FileInputStream;
Import java. io. FileNotFoundException;
Import java. io. IOException;
Import java. io. InputStream;
Import java. io. OutputStream;
Import java.net. Socket;
Import java. text. DateFormat;
Import java. text. SimpleDateFormat;
Import java. util. Date;
/*
* Created on 2004-12-21
*
* TODO To change the template for this generated file go
* Window-Preferences-Java-Code Style-Code Templates
*/
/**
* @ Author Administrator

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.