Mamadiyorov Soatmurot Toshkent – 2022 7-laboratoriya ishi Mavzu



Download 6,96 Kb.
bet1/3
Sana22.02.2023
Hajmi6,96 Kb.
#913666
  1   2   3
Bog'liq
7-8-labs


O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
LABORATORIYA
ISHI

Mavzu: 7-8-laboratoriya ishi


Bajardi:


Mamadiyorov Soatmurot


Toshkent – 2022
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.
Dastur kodi:
/*
* 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 pkg411.pkg19;

/**
*


* @author 01
*/
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 SendEmailUsingMaiRulSMTP {
public static void main(String[] args) {
// Recipient's email ID needs to be mentioned.
String to = "vmlld@hi2.in";//change accordingly
// Sender's email ID needs to be mentioned
String from = "burxon21@mail.ru";//change accordingly
final String username = "burxon21@mail.ru";//change accordingly
final String password = "LCmKE9uA7zhDdGzS97XR";//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()
{
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("laboratoriya ishi");
// Now set the actual message
message.setText("Assalomu alaykum 411-19 guruh talabasi "
+ "Teshaboyev Burxon");
// Send message
Transport.send(message);
System.out.println("Xabar muvaffaqiyatli jo'natildi....");
} catch (MessagingException e) {
throw new RuntimeException(e);
}
}
}



Download 6,96 Kb.

Do'stlaringiz bilan baham:
  1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish