Mail scheme updated v2
This commit is contained in:
@@ -65,13 +65,14 @@ exports.getTokenById = async (req, res, next) => {
|
||||
// Create token (without sending mail)
|
||||
exports.createToken = async (req, res, next) => {
|
||||
try {
|
||||
const { company_id, target_email, employee_name, template_type } = req.body;
|
||||
const { company_id, target_email, employee_name, template_type, from_name } = req.body;
|
||||
|
||||
const token = await tokenService.createToken({
|
||||
company_id,
|
||||
target_email,
|
||||
employee_name,
|
||||
template_type,
|
||||
from_name,
|
||||
});
|
||||
|
||||
const trackingUrl = `${process.env.BASE_URL}/t/${token.token}`;
|
||||
@@ -92,7 +93,7 @@ exports.createToken = async (req, res, next) => {
|
||||
// Create token and send mail
|
||||
exports.createAndSendToken = async (req, res, next) => {
|
||||
try {
|
||||
const { company_id, target_email, employee_name, template_type } = req.body;
|
||||
const { company_id, target_email, employee_name, template_type, from_name } = req.body;
|
||||
|
||||
// Create token
|
||||
const token = await tokenService.createToken({
|
||||
@@ -100,6 +101,7 @@ exports.createAndSendToken = async (req, res, next) => {
|
||||
target_email,
|
||||
employee_name,
|
||||
template_type,
|
||||
from_name,
|
||||
});
|
||||
|
||||
// Send mail
|
||||
|
||||
@@ -87,84 +87,116 @@ class OllamaService {
|
||||
|
||||
if (generate_html) {
|
||||
// Full HTML generation mode
|
||||
systemPrompt = `Sen profesyonel bir siber güvenlik uzmanısın ve şirketler için phishing farkındalık testi mail şablonları oluşturuyorsun.
|
||||
systemPrompt = `Sen profesyonel bir siber güvenlik uzmanısın ve phishing farkındalık test mail şablonları oluşturuyorsun.
|
||||
|
||||
GÖREV: Gerçekçi, ikna edici ve profesyonel phishing test mailleri oluştur.
|
||||
GÖREV: Gerçekçi, ikna edici ve SADECE TÜRKÇE HTML phishing test mailleri oluştur.
|
||||
|
||||
KURALLAR:
|
||||
1. Mail şablonları modern HTML/CSS ile tasarlanmalı
|
||||
2. Gerçek şirket maillerine benzer görünmeli
|
||||
3. İkna edici ve inandırıcı olmalı
|
||||
4. Türkçe dil bilgisi ve imla kurallarına uygun olmalı
|
||||
5. Kullanıcıyı aciliyet hissi ile harekete geçirmeli
|
||||
KRİTİK KURALLAR:
|
||||
1. ✅ SADECE TÜRKÇE kullan - İngilizce kelime YASAK!
|
||||
2. ✅ Modern HTML5 + inline CSS
|
||||
3. ✅ Gerçek kurumsal maillere benzer tasarım
|
||||
4. ✅ Gramer ve imla hatası OLMAYACAK
|
||||
5. ✅ Mantıklı ve tutarlı senaryo
|
||||
6. ✅ Responsive tasarım (max-width: 600px)
|
||||
7. ✅ Aciliyet vurgusu
|
||||
|
||||
ZORUNLU PLACEHOLDER'LAR:
|
||||
- {{company_name}} - Şirket adı
|
||||
- {{employee_name}} - Çalışan adı
|
||||
- {{tracking_url}} - Tıklama linki
|
||||
- {{employee_name}} - Çalışan adı
|
||||
- {{tracking_url}} - Link href'inde
|
||||
|
||||
KONU BAŞLIĞI:
|
||||
- Max 60 karakter
|
||||
- Net, çekici, TÜRKÇE
|
||||
- Senaryoya tam uygun
|
||||
|
||||
YANIT FORMATI: Sadece JSON!`;
|
||||
|
||||
userPrompt = `Aşağıdaki bilgilere göre profesyonel bir phishing test mail şablonu oluştur:
|
||||
userPrompt = `SENARYO DETAYLARI:
|
||||
|
||||
📌 HEDEF ŞİRKET: ${company_name}
|
||||
📌 SENARYO: ${scenario}`;
|
||||
🏢 Hedef Şirket/Kurum: ${company_name}
|
||||
📋 Senaryo: ${scenario}`;
|
||||
|
||||
if (employee_info) userPrompt += `\n📌 HEDEF KİTLE: ${employee_info}`;
|
||||
if (custom_prompt) userPrompt += `\n📌 ÖZEL TALİMATLAR: ${custom_prompt}`;
|
||||
if (employee_info) userPrompt += `\n👤 Hedef Kitle: ${employee_info}`;
|
||||
if (custom_prompt) userPrompt += `\n📌 Ek Talimatlar: ${custom_prompt}`;
|
||||
|
||||
userPrompt += `
|
||||
|
||||
JSON YANIT FORMATI:
|
||||
BEKLENEN JSON ÇIKTISI:
|
||||
{
|
||||
"subject": "İkna edici mail konusu (max 70 karakter)",
|
||||
"body": "<!DOCTYPE html><html><head><meta charset='UTF-8'><style>body{font-family:Arial,sans-serif;line-height:1.6;color:#333;max-width:600px;margin:0 auto;padding:20px;}h2{color:#d32f2f;}.button{display:inline-block;padding:12px 30px;background:#d32f2f;color:white;text-decoration:none;border-radius:5px;margin:20px 0;}</style></head><body><h2>Başlık</h2><p>Sayın {{employee_name}},</p><p>İçerik</p><a href='{{tracking_url}}' class='button'>Tıklayın</a></body></html>"
|
||||
"subject": "Net, çekici konu başlığı (max 60 karakter, SADECE TÜRKÇE)",
|
||||
"body": "<!DOCTYPE html><html><head><meta charset='UTF-8'><style>body{font-family:Arial,sans-serif;line-height:1.6;color:#333;max-width:600px;margin:0 auto;padding:20px;}h2{color:#d32f2f;}.button{display:inline-block;padding:12px 30px;background:#d32f2f;color:white;text-decoration:none;border-radius:5px;margin:20px 0;}</style></head><body><h2>Başlık</h2><p>Sayın {{employee_name}},</p><p>İçerik paragrafı...</p><a href='{{tracking_url}}' class='button'>Tıklayın</a><p style='font-size:12px;color:#666;'>Saygılarımızla,<br>{{company_name}}</p></body></html>"
|
||||
}
|
||||
|
||||
⚠️ SADECE JSON DÖNDÜR!`;
|
||||
⚠️ KRİTİK UYARILAR:
|
||||
1. SADECE TÜRKÇE - tek kelime bile İngilizce kullanma!
|
||||
2. HTML geçerli ve düzgün olmalı
|
||||
3. Inline CSS kullan
|
||||
4. {{tracking_url}} href içinde kullan
|
||||
5. Mantıklı senaryo - çelişki yok
|
||||
6. Konu başlığı senaryoya uygun
|
||||
7. SADECE JSON döndür!`;
|
||||
|
||||
|
||||
} else {
|
||||
// Text-only generation mode (RECOMMENDED)
|
||||
systemPrompt = `Sen profesyonel bir siber güvenlik uzmanısın ve phishing test mail içerikleri yazıyorsun.
|
||||
systemPrompt = `Sen Türk bir siber güvenlik uzmanısın. Anadilín Türkçe. SADECE TÜRKÇE yaz.
|
||||
|
||||
GÖREV: İkna edici, gerçekçi ve profesyonel mail içerikleri yaz.
|
||||
⛔ YASAKLAR - ASLA KULLANMA:
|
||||
- İngilizce kelime (the, and, or, please, click, link, button, security, etc.)
|
||||
- İspanyolca kelime (estamos, por favor, etc.)
|
||||
- Diğer diller
|
||||
- Yabancı kelime ekler (-tion, -ing, etc.)
|
||||
- Yarım Türkçe kelimeler (expectationsı, donecektir, etc.)
|
||||
|
||||
KURALLAR:
|
||||
1. Gerçek şirket maillerine benzer dil ve ton kullan
|
||||
2. İkna edici ve inandırıcı ol
|
||||
3. Türkçe dil bilgisi ve imla kurallarına uygun yaz
|
||||
4. Kullanıcıyı aciliyet hissi ile harekete geçir
|
||||
5. SADECE METİN İÇERİĞİ yaz, HTML TAG'LERİ KULLANMA!
|
||||
✅ ZORUNLULAR:
|
||||
- Sade, anlaşılır Türkçe
|
||||
- Kurumsal mail dili (resmi ama sıcak)
|
||||
- Doğru gramer (olmayacak, gerekmektedir, rica ederiz)
|
||||
- Kısa, net cümleler
|
||||
- Mantıklı akış
|
||||
|
||||
ZORUNLU PLACEHOLDER'LAR:
|
||||
- {{company_name}} - Şirket adı
|
||||
- {{employee_name}} - Çalışan adı
|
||||
- {{tracking_url}} - Link metni (örn: "buraya tıklayın", "hesabınızı doğrulayın")
|
||||
PLACEHOLDER'LAR:
|
||||
- {{company_name}} → Şirket adı
|
||||
- {{employee_name}} → Çalışan adı
|
||||
- {{tracking_url}} → AYRI SATIRDA, paragraf altında, link/buton olarak kullan
|
||||
|
||||
YANIT FORMATI: Sadece JSON!`;
|
||||
KONU:
|
||||
- Max 50 karakter
|
||||
- Türkçe, net, acil
|
||||
- Örnek: "Hesap Doğrulama Gerekli"
|
||||
|
||||
userPrompt = `Aşağıdaki bilgilere göre profesyonel bir phishing test mail içeriği yaz:
|
||||
JSON YANIT: Başka hiçbir şey yazma!`;
|
||||
|
||||
📌 HEDEF ŞİRKET: ${company_name}
|
||||
📌 SENARYO: ${scenario}`;
|
||||
userPrompt = `Şirket: ${company_name}
|
||||
Senaryo: ${scenario}`;
|
||||
|
||||
if (employee_info) userPrompt += `\n📌 HEDEF KİTLE: ${employee_info}`;
|
||||
if (custom_prompt) userPrompt += `\n📌 ÖZEL TALİMATLAR: ${custom_prompt}`;
|
||||
if (employee_info) userPrompt += `\nHedef: ${employee_info}`;
|
||||
if (custom_prompt) userPrompt += `\nEk: ${custom_prompt}`;
|
||||
|
||||
userPrompt += `
|
||||
|
||||
JSON YANIT FORMATI:
|
||||
BEKLENEN JSON:
|
||||
{
|
||||
"subject": "İkna edici mail konusu (max 70 karakter)",
|
||||
"body": "Mail içeriği buraya. Sayın {{employee_name}}, [mesajın içeriği]. Link metni için {{tracking_url}} placeholder'ını kullan. İmza kısmı."
|
||||
"subject": "Net konu (max 50 karakter)",
|
||||
"body": "Sayın {{employee_name}},\\n\\nDurum açıklaması.\\n\\nNe yapmalı ve neden önemli.\\n\\nLütfen aşağıdaki bağlantıyı kullanarak işleminizi tamamlayın:\\n{{tracking_url}}\\n\\nSon bilgi veya uyarı.\\n\\nSaygılarımızla,\\n{{company_name}}"
|
||||
}
|
||||
|
||||
⚠️ ÖNEMLİ:
|
||||
- Body içinde HTML TAG kullanma (<p>, <div> gibi)!
|
||||
- Sadece düz metin yaz!
|
||||
- Satır atlamak için sadece yeni satır kullan!
|
||||
- {{tracking_url}} placeholder'ını link metni içinde kullan (örn: "{{tracking_url}} buraya tıklayın")
|
||||
- SADECE JSON DÖNDÜR!`;
|
||||
⛔ YASAKLAR:
|
||||
- İngilizce/İspanyolca kelime YOK
|
||||
- HTML tag YOK
|
||||
- Karışık dil YOK
|
||||
- Yanlış gramer YOK
|
||||
- {{tracking_url}} cümle içinde kullanma!
|
||||
|
||||
✅ İYİ ÖRNEK:
|
||||
{
|
||||
"subject": "Hesap Doğrulama Gerekli",
|
||||
"body": "Sayın {{employee_name}},\\n\\nHesabınızda şüpheli giriş denemesi tespit edildi. Güvenliğiniz için hesabınızı doğrulamanız gerekmektedir.\\n\\nLütfen aşağıdaki bağlantıyı kullanarak 24 saat içinde doğrulama yapın:\\n{{tracking_url}}\\n\\nDoğrulama yapılmadığı takdirde hesabınız geçici olarak askıya alınacaktır.\\n\\nSaygılarımızla,\\n{{company_name}} Güvenlik Ekibi"
|
||||
}
|
||||
|
||||
⚠️ ÖNEMLİ: {{tracking_url}} AYRI SATIRDA OLMALI!
|
||||
⚠️ SADECE JSON - başka bir şey yazma!`;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -303,9 +335,13 @@ JSON YANIT FORMATI:
|
||||
.split('\n\n')
|
||||
.filter(p => p.trim())
|
||||
.map(p => {
|
||||
// Replace {{tracking_url}} placeholder with styled link
|
||||
// If paragraph is ONLY {{tracking_url}}, make it a centered button
|
||||
if (p.trim() === '{{tracking_url}}') {
|
||||
return `<div style="text-align: center; margin: 30px 0;"><a href="{{tracking_url}}" class="button">Buraya Tıklayın</a></div>`;
|
||||
}
|
||||
// If paragraph contains {{tracking_url}} within text, replace inline
|
||||
if (p.includes('{{tracking_url}}')) {
|
||||
return `<p>${p.replace(/\{\{tracking_url\}\}/g, '<a href="{{tracking_url}}" class="button">Buraya Tıklayın</a>')}</p>`;
|
||||
return `<p>${p.replace(/\{\{tracking_url\}\}/g, '<a href="{{tracking_url}}" style="color: ' + style.button + '; font-weight: bold; text-decoration: underline;">buraya tıklayın</a>')}</p>`;
|
||||
}
|
||||
return `<p>${p}</p>`;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user