Read about java code to send email using smtp, The latest news, videos, and discussion topics about java code to send email using smtp from alibabacloud.com
Today, I have nothing to worry about. on Weibo, I saw a program for sending text messages via Java. I looked at it and did not believe it. I am not sure about it. I will sort it out and may need it later.
There are several methods to send text messages via Java: (1) Use the WebService interface to send text messages, w
//* @Descripti On mail Send test class//*/public class Sendmailtest {public static void main (string[] args) throws Exception {//configuration information Properties Pro = new properties (); Pro.put ("Mail.smtp.host", "smtp.163.com"); Pro.put ("Mail.smtp.auth", "true"); SSL encryption mailsslsocketfactory SF = NULL; SF = new MailSslsocketfactory (); Set to trust all
a remote object (winform)
Simpleserver: listens to client requests and creates an object (winform)
2. Create a remote call class under the remoteobject project: remoteobject. CS
Create the form1.csand simpleclient.exe. config configuration files under the simpleclient project.
The configuration file specifies the server address, channel, and other information. The following code provides a detailed description.
Create the form1.csand simple
Last time to share how to send Simple mail, this time to everyone to continue to share the delivery of attachments, embedded HTML, template files sent.Send a message with an attachment:Multipart email allows to add attachments and embedded resources (inline Resource);Using a simple JPEG image as an attachment, android.png is placed in the project's root directory
escape of the dollar sign: $ ==> u0024 Escape of the symbol: ^ ==> u005e escape of the opening brace: {==> u007b Escape of the left parenthesis: [==> u005b escape of the Left parenthesis: (==> u0028 Escape of the vertical bar: | ==> u007c The escape of the right parenthesis:) ==> u0029 Escape of Asterisk: * ==> u002a Plus escape: + ==> u002b escape of question mark:? ==> u003f Backslash escape: = = > u005c ====================================================================== The f
account here"); } }); //Create a Mail objectMessage message =NewMimeMessage (session); //Set SenderMessage.setfrom (NewInternetAddress ("[Email protected]")); //Set RecipientMessage.setrecipient (Message.RecipientType.TO,Newinternetaddress (to)); //Set ThemeMessage.setsubject ("This is a test mail"); //Set message body The second parameter is the type of message sentMessage.setcontent (text, "Text/html;charset=utf-8"); //
These days, the boss let me get a message verification code to send the function, the use of the letter easy access to the SMS platform interface, and then in Java using httpclient analog POST request or GET request (see the message platform requirements, the general situation is a POST request), Invoke the interface p
URLConnection is an abstract class that has two direct subclasses, respectively, HttpURLConnection and Jarurlconnection. Another important class is the URL, which typically generates a URL instance to a specific address by passing the constructor a string parameter.
Each httpurlconnection instance can be used to generate a single request, but other instances can transparently share the underlying network that connects to the HTTP server. After the request, the close () method is raised in the H
{mailsender.send (message);
result = "Email is sent!";
}catch (mailexception e) {result = "sending email failed!
Mail form:
To send a message with an attachment:
try{
Javamailsenderimpl Senderimpl = new Javamailsenderimpl ();
Properties Props = new properties ();
Props.put ("Mail.smtp.auth", "true");
Senderimpl.sethos
, increase system performance15.uploadify upload plugin, single, batch upload multi-threaded, with progress bar, asynchronous, image, video, other file formats can be uploaded16.tab label page function, tag free switch, not duplicate operation database17. Baidu Rich Text editor, can upload pictures18. Web crawler technology, can be based on the Web site to crawl pictures and page titles and other information (crawl a store image to save the server)19.java
The Cocos2d-x3.3RC0 calls Android Java layer URI code through JNI to send SMS, cocos2d-x3.3rc0jni1. If Jni is not described in detail, refer to the previous blog 2. directly go to code 1) Java layer and add it directly to AppActivity. ja
();} #endifTest.cpp Note that these two pieces of code are changed in the previous code, and some of the code is not related to this feature. Please delete it yourself.#include "test.h" #include "cocos2d.h" #include "platform/android/jni/jnihelper.h" #include ". /.. /.. /classes/jnitest.h "#include 3) C + + layervoid Helloworld::menuclosecallback (ref* psender)
Note that these two pieces of code are modified in the previous code, and some of the code is not related to this feature. Please delete it yourself. #include "test.h" #include "cocos2d.h" #include "platform/android/jni/jnihelper.h" #include ". /.. /.. /classes/jnitest.h "#include 3) C + + layervoid Helloworld::menuclosecallback (ref* psender) {#if (Cc_target_pl
) {//MimeBodyPart for storing mail attachments MimeBodyPart attachment = NULL; File file = null; for (int i = 0; i }public static void Main (string[] args) {Create message informationCreate message informationMailsenderinfo mailinfo = new Mailsenderinfo ();Mailinfo.setmailserverhost ("Mail. XXX.com ")//mail.qq.com this own look at the type of Baidu query, our company address does not discloseMailinfo.setmailserverport ("25");Mailinfo.setvalidate (TRUE);Mailinfo.setuserna
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.