|
|
using UnityEngine;
|
|
|
using UnityEditor;
|
|
|
using System.IO;
|
|
|
|
|
|
public class EmailAssetGenerator
|
|
|
{
|
|
|
[MenuItem("Tools/Generate Sample EmailData Assets")]
|
|
|
public static void GenerateEmailAssets()
|
|
|
{
|
|
|
string folderPath = "Assets/ScriptableObjects/Emails";
|
|
|
if (!AssetDatabase.IsValidFolder("Assets/ScriptableObjects"))
|
|
|
{
|
|
|
AssetDatabase.CreateFolder("Assets", "ScriptableObjects");
|
|
|
}
|
|
|
if (!AssetDatabase.IsValidFolder(folderPath))
|
|
|
{
|
|
|
AssetDatabase.CreateFolder("Assets/ScriptableObjects", "Emails");
|
|
|
}
|
|
|
|
|
|
CreateEmail("IT Support", "it.support@yourcompany.com", "Scheduled Maintenance Notification",
|
|
|
"Dear Team,\n\nWe would like to inform you about a scheduled system maintenance that will take place this Friday, starting at 10:00 PM and continuing until approximately 2:00 AM. During this window, access to internal tools, shared drives, and the intranet may be temporarily unavailable. This maintenance is necessary to apply critical security updates and improve system performance.\n\nPlease ensure that you save all your work and log off your devices before 9:45 PM to prevent any data loss or corruption. If you encounter any issues after the maintenance period, feel free to contact our helpdesk.\n\nThank you for your cooperation.\n– IT Support",
|
|
|
"", false, false, "Today", folderPath);
|
|
|
|
|
|
CreateEmail("HR Department", "hr@yourcompany.com", "May HR Newsletter Available",
|
|
|
"Hello Everyone,\n\nWe’re excited to bring you the May edition of our HR Newsletter! This month’s issue includes wellness challenges to help you stay active, updates on remote work policy extensions, employee spotlight stories, and upcoming team-building activities. Be sure to check the HR Portal to see who’s celebrating work anniversaries and birthdays.\n\nAlso, please review the newly updated policy on hybrid attendance and submit your feedback by next week. The first 50 employees to complete the Wellness Bingo will receive a surprise reward!\n\n– HR Team",
|
|
|
"", true, false, "Yesterday", folderPath);
|
|
|
|
|
|
CreateEmail("Sarah Thompson", "sarah.thompson@yourcompany.com", "Team Sync – Monday 10 AM",
|
|
|
"Hi team,\n\nJust a quick reminder that our weekly sync is scheduled for Monday at 10:00 AM. We’ll meet in Conference Room B or via Zoom for remote team members. Please come prepared with updates on your current sprint tasks, blockers you've encountered, and any cross-team dependencies that need escalation.\n\nWe’ll also spend a few minutes discussing this month’s product feedback summary and suggestions for improving sprint velocity. Let me know if there’s anything you’d like to add to the agenda.\n\nBest,\nSarah",
|
|
|
"", false, false, "May 25", folderPath);
|
|
|
|
|
|
CreateEmail("Finance Team", "finance@yourcompany.com", "Reimbursement Processed – $124",
|
|
|
"Hi Alex,\n\nYour expense reimbursement request for the business lunch on May 20th has been successfully processed. A total of $124.00 has been approved and scheduled for transfer to your designated account. The amount should reflect in your bank statement within 2–3 business days.\n\nFor transparency, the reimbursement was processed under Request ID #R30492. You can track the status of this and future reimbursements in the Finance Portal.\n\nIf there are any discrepancies, please don’t hesitate to contact us at finance@yourcompany.com.\n\n– Finance Department",
|
|
|
"", false, false, "May 24", folderPath);
|
|
|
}
|
|
|
|
|
|
private static void CreateEmail(string senderName, string senderEmail, string subject, string body,
|
|
|
string link, bool attachment, bool phishing, string date, string folderPath)
|
|
|
{
|
|
|
EmailData asset = ScriptableObject.CreateInstance<EmailData>();
|
|
|
asset.senderName = senderName;
|
|
|
asset.senderEmail = senderEmail;
|
|
|
asset.subject = subject;
|
|
|
asset.fullBodyText = body;
|
|
|
asset.linkPreview = link;
|
|
|
asset.hasAttachment = attachment;
|
|
|
asset.isPhishing = phishing;
|
|
|
asset.timeOrDate = date;
|
|
|
|
|
|
string safeFileName = subject.Replace(" ", "_").Replace("–", "-").Replace(":", "").Replace("/", "-");
|
|
|
string path = $"{folderPath}/{safeFileName}.asset";
|
|
|
AssetDatabase.CreateAsset(asset, path);
|
|
|
AssetDatabase.SaveAssets();
|
|
|
Debug.Log($"✅ Created EmailData asset at: {path}");
|
|
|
}
|
|
|
}
|