HLJS Pre Code
HLJS Pre Code

HLJS Pre Code

April 29, 2024
HLJS Pre code

Test beberapa Pre Code pada Blog ini

public class Main {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}
git init
git status
git Add *
git commit -m "isi comment"
git push origin main
body {
  background-color: lightblue;
}

h1 {
  color: white;
  text-align: center;
}

p {
  font-family: verdana;
  font-size: 20px;
}
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap demo</title>
  </head>
  <body>
    <h1>Hello, world!</h1>
  </body>
</html>
// Create a Set
const letters = new Set(["a","b","c"]);

// Get all Values
const myIterator = letters.values();

// List all Values
let text = "";
for (const entry of myIterator) {
  text += entry;
}
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});
<?php
echo "Hello World!";
?>
import pandas as pd
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

# Fungsi untuk mengirim email
def send_email(to_address, subject, body, from_address, password):
    msg = MIMEMultipart()
    msg['From'] = from_address
    msg['To'] = to_address
    msg['Subject'] = subject
    msg.attach(MIMEText(body, 'plain'))
    
    try:
        # Menghubungkan ke server SMTP (contoh: Gmail)
        server = smtplib.SMTP('smtp.gmail.com', 587)
        server.starttls()
        server.login(from_address, password)
        server.sendmail(from_address, to_address, msg.as_string())
        server.close()
        print(f"Email sent to {to_address}")
    except Exception as e:
        print(f"Failed to send email to {to_address}: {e}")

# Membaca data dari file Excel
excel_file = 'customer_emails.xlsx'  # Ganti dengan nama file Excel Anda
data = pd.read_excel(excel_file)

# Informasi pengirim
from_address = 'your_email@gmail.com'  # Ganti dengan email Anda
password = 'your_email_password'       # Ganti dengan password email Anda
subject = 'Perkenalan Produk Baru'
body_template = '''
Yth. {title} {name},

Kami dari [Nama Perusahaan] ingin memperkenalkan produk terbaru kami kepada Anda. [Deskripsi Produk].

Salam hormat,
[Nama Anda]
'''

# Mengirim email ke setiap pelanggan
for index, row in data.iterrows():
    to_address = row['Email']  # Ganti 'Email' dengan nama kolom yang sesuai di file Excel Anda
    title = row['Title']       # Ganti 'Title' dengan nama kolom yang sesuai di file Excel Anda
    name = row['Name']         # Ganti 'Name' dengan nama kolom yang sesuai di file Excel Anda
    body = body_template.format(title=title, name=name)
    send_email(to_address, subject, body, from_address, password)