• Ishning maqsadi
  • Mavzu: Elektron pochta tarmoq dasturini yaratish




    Download 251.3 Kb.
    Sana06.01.2024
    Hajmi251.3 Kb.
    #130965
    Bog'liq
    7-8Lab
    4-Laboratoriya ishi Mantiqiy signallarning indikatorini tadqiq, 2-labaratoriya, ChiziqliMasalalar, 13Lab, 1 топшириқ Ҳаёт фаолияти хавфсизлиги Javohir, 1-ish l, 7. Mantiqiy amallar (2), 14lab, 15lab, 13lab, 6lab

    Mahkamov Mohirbek
    7-LABORATORIYA ISHI
    Mavzu: Elektron pochta tarmoq dasturini yaratish

    Ishning maqsadi: Talabalarda Java dasturlash tili javax.mail.* va java.util.* paketlari klasslaridan foydalanib elektron pochta bilan ishlovchi dastur yaratish bo‘yicha amaliy ko‘nikmalar hosil qilish.

    Kod qismi:


    /*
    * To change this license header, choose License Headers in Project Properties.
    * To change this template file, choose Tools | Templates
    * and open the template in the editor.
    */
    package ElbekSendEmail;

    import java.util.Properties;


    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class ElbekSendEmail {
    public static void main(String[] args) {
    // Recipient's email ID needs to be mentioned.
    String to = "ulugbek0911uz@mail.ru";//change accordingly
    // Sender's email ID needs to be mentioned
    String from = "elbeknoname1@mail.ru";//change accordingly
    final String username = "elbeknoname1@mail.ru";//change accordingly
    final String password = "SkMrsfqsSwXWSaCnhvqN";//change accordingly
    // Assuming you are sending email through relay.jangosmtp.net
    String host = "smtp.mail.ru";
    Properties props = new Properties();
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.port", "465");
    props.put("mail.smtps.ssl.checkserveridentity", true);
    props.put("mail.smtps.ssl.trust", "*");
    props.put("mail.smtp.ssl.enable", "true");
    // Get the Session object.
    Session session = Session.getInstance(props,new javax.mail.Authenticator()
    {
    @Override
    protected PasswordAuthentication getPasswordAuthentication()
    {
    return new PasswordAuthentication(username, password);
    }
    });
    try {
    // Create a default MimeMessage object.
    Message message = new MimeMessage(session);
    // Set From: header field of the header.
    message.setFrom(new InternetAddress(from));
    // Set To: header field of the header.
    message.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(to));
    // Set Subject: header field
    message.setSubject("7-Laboratoriya ishi");
    // Now set the actual message
    message.setText("Assalom alaykum Elbek sizga xabar jo'natdi !!!");
    // Send message
    Transport.send(message);
    System.out.println("Xabar muvaffaqiyatli jo'natildi....");
    } catch (MessagingException e) {
    //throw new RuntimeException(e);
    }
    }
    }


    8-LABORATORIYA ISHI


    Mavzu: AJAX asosida tarmoq dasturini yaratish

    Ishning maqsadi: Talabalarda Java dasturlash tilida XMLHttpRequest obyektidan foydalanib AJAX asosida tarmoq dasturini yaratish bo‘yicha amaliy ko‘nikmalar hosil qilish.

    AJAX_XML.html






    The XMLHttpRequest Object














    Download 251.3 Kb.




    Download 251.3 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Mavzu: Elektron pochta tarmoq dasturini yaratish

    Download 251.3 Kb.