powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / вопрос
2 сообщений из 2, страница 1 из 1
вопрос
    #33782248
tets
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Всем привет, вопрос начинающего. Создал Java Sources, откомпилировал всё нормально. Что я должен сделать дальше, как в SQL Plus сделать выполнение ? Я должен создать пакет или процедуру ? Заранее извиняюсь за глупый вопрос. И спасибо за возможный ответ.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
 import  javax.activation.DataHandler;
 import  javax.mail.Message;
 import  javax.mail.Multipart;
 import  javax.mail.Session;
 import  javax.mail.Transport;
 import  javax.mail.internet.InternetAddress;
 import  javax.mail.internet.MimeBodyPart;
 import  javax.mail.internet.MimeMessage;
 import  javax.mail.internet.MimeMultipart;
 import  java.util.Date;
 import  java.util.Properties;
 public   class  SendFile {
   private   static   final  String FROM = "Email.ru";
   private   static   final  String TO = "Email.ru";
   private   static   final  String HOST = "mail.ttt.ru";
   private   static   final  String CHARSET = "utf-8";
   private   static   final  String BODY = "Всем привет !";
   private   static   final  String SUBJECT = "Sent UTF file Отправка UTF файла";
   private   static   final  String FILE_NAME = "test.txt";
   public   static   void  main(String[] args)
     throws  Exception {
     boolean  debug = true;
    // Create some properties and get the default Session
    Properties props = System.getProperties();
    props.put("mail.smtp.host", HOST);
    Session session = Session.getInstance(props,  null );
    session.setDebug(debug);
    // Create a message
    MimeMessage msg =  new  MimeMessage(session);
    msg.setFrom( new  InternetAddress(FROM));
    InternetAddress[] address = { new  InternetAddress(TO)};
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject(SUBJECT, CHARSET);
    // Create and fill the first message part
    MimeBodyPart bodyPart =  new  MimeBodyPart();
    bodyPart.setText(BODY, CHARSET);
    // Create the second message part
    MimeBodyPart attachmentPart =  new  MimeBodyPart();
    // Аttach the text file to the message
    ByteArrayDataSource dataSource =  new  ByteArrayDataSource(
      BODY, "text/plain; charset=" + CHARSET
    );
    attachmentPart.setDataHandler( new  DataHandler(dataSource));
    attachmentPart.setFileName(FILE_NAME);
    // Create the Multipart and add its parts to it
    Multipart mp =  new  MimeMultipart();
    mp.addBodyPart(bodyPart);
    mp.addBodyPart(attachmentPart);
    // Add the Multipart to the message
    msg.setContent(mp);
    // Set the Date: header
    msg.setSentDate( new  Date());
    // Send the message
    Transport.send(msg);
  }
}
...
Рейтинг: 0 / 0
вопрос
    #33782673
Фотография Timm
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
посмотреть в фак и сделать также.
зы. ище src есть. так, на всякий.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
 import  javax.activation.DataHandler;
 import  javax.mail.Message;
 import  javax.mail.Multipart;
 import  javax.mail.Session;
 import  javax.mail.Transport;
 import  javax.mail.internet.InternetAddress;
 import  javax.mail.internet.MimeBodyPart;
 import  javax.mail.internet.MimeMessage;
 import  javax.mail.internet.MimeMultipart;
 import  java.util.Date;
 import  java.util.Properties;

 public   class  SendFile
{
     private   static   final  String FROM = "Email.ru";
     private   static   final  String TO = "Email.ru";
     private   static   final  String HOST = "mail.ttt.ru";
     private   static   final  String CHARSET = "utf-8";
     private   static   final  String BODY = "Всем привет !";
     private   static   final  String SUBJECT = "Sent UTF file Отправка UTF файла";
     private   static   final  String FILE_NAME = "test.txt";

     public   static   void  main(String[] args)
             throws  Exception
    {
         boolean  debug = true;
// Create some properties and get the default Session
        Properties props = System.getProperties();
        props.put("mail.smtp.host", HOST);
        Session session = Session.getInstance(props,  null );
        session.setDebug(debug);
// Create a message
        MimeMessage msg =  new  MimeMessage(session);
        msg.setFrom( new  InternetAddress(FROM));
        InternetAddress[] address = {  new  InternetAddress(TO) };
        msg.setRecipients(Message.RecipientType.TO, address);
        msg.setSubject(SUBJECT, CHARSET);
// Create and fill the first message part
        MimeBodyPart bodyPart =  new  MimeBodyPart();
        bodyPart.setText(BODY, CHARSET);
// Create the second message part
        MimeBodyPart attachmentPart =  new  MimeBodyPart();
// Аttach the text file to the message
        ByteArrayDataSource dataSource =  new  ByteArrayDataSource(
                BODY, "text/plain; charset=" + CHARSET
        );
        attachmentPart.setDataHandler( new  DataHandler(dataSource));
        attachmentPart.setFileName(FILE_NAME);
// Create the Multipart and add its parts to it
        Multipart mp =  new  MimeMultipart();
        mp.addBodyPart(bodyPart);
        mp.addBodyPart(attachmentPart);
// Add the Multipart to the message
        msg.setContent(mp);
// Set the Date: header
        msg.setSentDate( new  Date());
// Send the message
        Transport.send(msg);
    }
}
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / вопрос
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]