Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 日韩电影免费在线观看视频,高清国产美女一级毛片,中文字幕先锋影音

          整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          Java發送QQ郵件

          Java發送QQ郵件

          天學習了如何用Java[1] 發送普通郵件,HTML郵件和帶附件的郵件。黑客最喜歡干的事情就是發釣魚郵件,安全磚家還為其美名叫魚叉攻擊,嘖嘖。

          ailx10:網絡安全優秀回答者,網絡安全碩士


          發送一封簡單的QQ郵件:

          • 收件人會收到純文本的郵件!
          package hackbiji;
          
          import javax.mail.*;
          import javax.mail.internet.InternetAddress;
          import javax.mail.internet.MimeMessage;
          import java.util.Properties;
          
          public class hello {
              public static void main(String[] args) {
                  String to="792161993@qq.com";
                  String from="393803933@qq.com";
                  String host="smtp.qq.com";
                  Properties properties=System.getProperties();
                  properties.setProperty("mail.smtp.host",host);
                  properties.put("mail.smtp.auth","true");
          
          
                  Session session=Session.getDefaultInstance(properties, new Authenticator() {
                      public PasswordAuthentication getPasswordAuthentication()
                      {
                          return new PasswordAuthentication("393803933","***********");
                      }
                  });
          
                  try {
                      MimeMessage mimeMessage=new MimeMessage(session);
                      mimeMessage.setFrom(new InternetAddress(from));
                      mimeMessage.addRecipient(Message.RecipientType.TO,
                              new InternetAddress(to));
                      mimeMessage.setSubject("主題:黑客筆記");
                      mimeMessage.setText("正文:我是ailx10,我喜歡2進制安全和滲透技術");
                      Transport.send(mimeMessage);
                      System.out.println("發送郵件成功");
          
                  } catch (MessagingException e) {
                      e.printStackTrace();
                  }
          
              }
          }

          發送一封HTML QQ郵件:

          • 收件人會收到HTML的郵件,這里就可以做成釣魚鏈接了!
          package hackbiji;
          
          import javax.mail.*;
          import javax.mail.internet.InternetAddress;
          import javax.mail.internet.MimeMessage;
          import java.util.Properties;
          
          public class hello {
              public static void main(String[] args) {
                  String to="792161993@qq.com";
                  String from="393803933@qq.com";
                  String host="smtp.qq.com";
                  Properties properties=System.getProperties();
                  properties.setProperty("mail.smtp.host",host);
                  properties.put("mail.smtp.auth","true");
          
          
                  Session session=Session.getDefaultInstance(properties, new Authenticator() {
                      public PasswordAuthentication getPasswordAuthentication()
                      {
                          return new PasswordAuthentication("393803933@qq.com","************");
                      }
                  });
          
                  try {
                      MimeMessage mimeMessage=new MimeMessage(session);
                      mimeMessage.setFrom(new InternetAddress(from));
                      mimeMessage.addRecipient(Message.RecipientType.TO,
                              new InternetAddress(to));
                      mimeMessage.setSubject("主題:黑客筆記");
                      mimeMessage.setContent("<img src=\"http://hackbiji.top/images/avatar.jpg\" width=\"50\" height=\"50\" />","text/html");
                      Transport.send(mimeMessage);
                      System.out.println("發送郵件成功");
          
                  } catch (MessagingException e) {
                      e.printStackTrace();
                  }
          
              }
          }

          發送一封帶附件的QQ郵件

          package hackbiji;
          
          import javax.activation.DataHandler;
          import javax.activation.FileDataSource;
          import javax.mail.*;
          import javax.mail.internet.InternetAddress;
          import javax.mail.internet.MimeBodyPart;
          import javax.mail.internet.MimeMessage;
          import javax.mail.internet.MimeMultipart;
          import java.util.Properties;
          
          public class hello {
              public static void main(String[] args) {
                  String to="792161993@qq.com";
                  String from="393803933@qq.com";
                  String host="smtp.qq.com";
                  Properties properties=System.getProperties();
                  properties.setProperty("mail.smtp.host",host);
                  properties.put("mail.smtp.auth","true");
          
          
                  Session session=Session.getDefaultInstance(properties, new Authenticator() {
                      public PasswordAuthentication getPasswordAuthentication()
                      {
                          return new PasswordAuthentication("393803933@qq.com","***********");
                      }
                  });
          
                  try {
                      MimeMessage mimeMessage=new MimeMessage(session);
                      mimeMessage.setFrom(new InternetAddress(from));
                      mimeMessage.addRecipient(Message.RecipientType.TO,
                              new InternetAddress(to));
                      mimeMessage.setSubject("主題:黑客筆記");
          
                      MimeBodyPart msgBodyPart=new MimeBodyPart();
                      msgBodyPart.setText("正文:我是ailx10");
                      MimeMultipart mimeMultipart=new MimeMultipart();
                      mimeMultipart.addBodyPart(msgBodyPart);
                      msgBodyPart=new MimeBodyPart();
                      String filepath="C:\\Users\\Admin\\IdeaProjects\\helloworld\\src\\src\\main\\java\\hackbiji\\hack.zip";
                      String filename="hack.zip";
                      FileDataSource fileDataSource=new FileDataSource(filepath);
                      msgBodyPart.setDataHandler(new DataHandler(fileDataSource));
                      msgBodyPart.setFileName(filename);
                      mimeMultipart.addBodyPart(msgBodyPart);
          
                      mimeMessage.setContent(mimeMultipart);
          
                      Transport.send(mimeMessage);
                      System.out.println("發送郵件成功");
          
                  } catch (MessagingException e) {
                      e.printStackTrace();
                  }
          
              }
          }

          參考

          1. ^Java入門教程 https://www.runoob.com/java/java-tutorial.html

          Python中,可以使用smtplib庫和email庫來發送郵件。以下是一個基本的示例,展示如何使用這些庫來發送一封簡單的郵件。

          步驟 1: 安裝必要的庫

          smtplib和email是Python的標準庫,通常不需要單獨安裝。但是,如果你使用的是一個精簡的Python環境,可能需要確保這些庫是可用的。

          步驟 2: 編寫郵件發送腳本

          Python
          1import smtplib
          2from email.mime.text import MIMEText
          3from email.header import Header
          4
          5# 發件人郵箱
          6sender='your_email@example.com'
          7# 收件人郵箱
          8receiver='receiver_email@example.com'
          9# 發送郵件的SMTP服務器
          10smtp_server='smtp.example.com'
          11# 發件人的郵箱密碼或授權碼
          12password='your_password'
          13
          14# 郵件內容
          15mail_content='這是郵件的正文內容。'
          16# 郵件主題
          17mail_subject='郵件的主題'
          18
          19# 創建一個MIMEText對象
          20message=MIMEText(mail_content, 'plain', 'utf-8')
          21message['From']=Header("發件人名稱", 'utf-8')
          22message['To']=Header("收件人名稱", 'utf-8')
          23message['Subject']=Header(mail_subject, 'utf-8')
          24
          25try:
          26    # 連接SMTP服務器
          27    smtpObj=smtplib.SMTP(smtp_server, 587)
          28    # 開啟TLS加密(某些服務器需要)
          29    smtpObj.starttls()
          30    # 登錄SMTP服務器
          31    smtpObj.login(sender, password)
          32    # 發送郵件
          33    smtpObj.sendmail(sender, receiver, message.as_string())
          34    print("郵件發送成功!")
          35except smtplib.SMTPException as e:
          36    print("Error: 無法發送郵件,錯誤信息:", e)
          37finally:
          38    # 關閉連接
          39    smtpObj.quit()

          注意事項:

          1. SMTP服務器和端口:不同的郵件服務商有不同的SMTP服務器地址和端口號。例如,Gmail的SMTP服務器是smtp.gmail.com,端口號是587。
          2. 授權碼:對于某些郵件服務商,如Gmail,你需要使用應用密碼(也叫授權碼)而不是你的登錄密碼來發送郵件,因為直接使用登錄密碼可能會被阻止。
          3. TLS/SSL加密:大多數現代郵件服務都要求使用TLS或SSL加密來保證通信安全。在連接SMTP服務器時,確保使用starttls()或SMTP_SSL類來啟用加密。
          4. 郵件格式:上面的例子使用的是純文本郵件。如果你想發送HTML格式的郵件或包含附件的郵件,可以使用email.mime.multipart.MIMEMultipart和相關的子類來構建郵件。

          通過調整上述代碼中的SMTP服務器、端口、用戶名、密碼以及郵件內容和接收者,你可以根據自己的需求發送郵件。

          到一個比較有意思的網站,資源不少,在富文本框中直接復制了html,現在想把這些html中的附件下載到自己的服務器上,首先需要分析一下html把這些軟件的src找出來


          // <summary> 
          /// 獲取字符串中SRC集合 
          /// </summary> 
          /// <param name="content">字符串</param> 
          /// <returns></returns> 
          public List<string> GetALLSRC(string content)
          {
              Regex rg=new Regex("src=\"([^\"]+)\"", RegexOptions.IgnoreCase);
              var img=rg.Match(content);
              List<string> imgUrl=new List<string>();
              while (img.Success)
              {
                  imgUrl.Add(img.Groups[1].Value);
                  img=img.NextMatch();
              }
              return imgUrl;
          }

          這樣我們就可以用像kindediter等富文本工具先將目標html弄到自己的項目中,然后用上面的函數把其中的附件的下載地址分析出來,再根據種類進行分類,前面我也提到過如何把遠程文件復制到自己的項目中,這里就不說了。


          主站蜘蛛池模板: 最新欧美精品一区二区三区 | 乱码精品一区二区三区| 日韩有码一区二区| 99精品高清视频一区二区| 亚洲AV成人精品日韩一区 | 搡老熟女老女人一区二区| 欧洲精品一区二区三区在线观看| 久久久久人妻精品一区蜜桃| 冲田杏梨高清无一区二区| 国产一区二区三区播放心情潘金莲| 国产在线一区二区| 中文字幕久久亚洲一区| 亚洲Aⅴ无码一区二区二三区软件| 成人免费视频一区| 亚洲熟女www一区二区三区| 无码人妻精品一区二区三区66| 国产亚洲日韩一区二区三区| 国产高清在线精品一区二区三区| 精品免费国产一区二区| 天堂一区二区三区在线观看| 国产乱人伦精品一区二区| 久久久久无码国产精品一区 | 久久久精品人妻一区二区三区蜜桃 | 无码精品国产一区二区三区免费| 久久久久国产一区二区三区| 成人无码一区二区三区| 精品国产不卡一区二区三区| 精品国产亚洲一区二区在线观看| 国产福利电影一区二区三区,亚洲国模精品一区 | 国产精品视频第一区二区三区| 精品日本一区二区三区在线观看| 久久久不卡国产精品一区二区| 一区二区三区午夜| 国产在线一区二区| 国产精品久久一区二区三区| 国产一区二区不卡老阿姨| 精品国产日韩亚洲一区91| 日韩精品一区二区三区影院| 国产亚洲一区二区三区在线不卡| 无码人妻精品一区二区三区东京热| 91精品国产一区二区三区左线|