DeepCoreB4 commited on
Commit
addea71
·
verified ·
1 Parent(s): 1d256db

Upload tools.py

Browse files
Files changed (1) hide show
  1. tools.py +15 -3
tools.py CHANGED
@@ -252,6 +252,9 @@ async def send_email(
252
  </div>
253
  """
254
 
 
 
 
255
  try:
256
  async with aiohttp.ClientSession() as session:
257
  async with session.post(
@@ -259,9 +262,10 @@ async def send_email(
259
  headers={
260
  "Authorization": f"Bearer {resend_key}",
261
  "Content-Type": "application/json",
 
262
  },
263
  json={
264
- "from": "Elite <elite@webstark.org>",
265
  "to": [to_email],
266
  "subject": subject,
267
  "html": html_body,
@@ -452,6 +456,9 @@ async def _notify_new_lead(lead_data: dict) -> None:
452
  logger.info("Kein RESEND_API_KEY – Lead-Benachrichtigung übersprungen.")
453
  return
454
 
 
 
 
455
  try:
456
  async with aiohttp.ClientSession() as session:
457
  await session.post(
@@ -459,9 +466,10 @@ async def _notify_new_lead(lead_data: dict) -> None:
459
  headers={
460
  "Authorization": f"Bearer {resend_key}",
461
  "Content-Type": "application/json",
 
462
  },
463
  json={
464
- "from": "Elite <elite@webstark.org>",
465
  "to": [notify_email],
466
  "subject": f"🔥 Neuer Lead: {lead_data['name']} – {lead_data['interest']}",
467
  "html": f"""
@@ -487,6 +495,9 @@ async def _notify_summary(summary: dict) -> None:
487
  if not resend_key:
488
  return
489
 
 
 
 
490
  try:
491
  async with aiohttp.ClientSession() as session:
492
  await session.post(
@@ -494,9 +505,10 @@ async def _notify_summary(summary: dict) -> None:
494
  headers={
495
  "Authorization": f"Bearer {resend_key}",
496
  "Content-Type": "application/json",
 
497
  },
498
  json={
499
- "from": "Elite <elite@webstark.org>",
500
  "to": [notify_email],
501
  "subject": f"📝 Gesprächs-Zusammenfassung: {summary['customer_name']}",
502
  "html": f"""
 
252
  </div>
253
  """
254
 
255
+ resend_from_name = os.environ.get("RESEND_FROM_NAME", "Elite")
256
+ resend_from_email = os.environ.get("RESEND_FROM_EMAIL", "elite@webstark.org")
257
+
258
  try:
259
  async with aiohttp.ClientSession() as session:
260
  async with session.post(
 
262
  headers={
263
  "Authorization": f"Bearer {resend_key}",
264
  "Content-Type": "application/json",
265
+ "Accept-Encoding": "identity",
266
  },
267
  json={
268
+ "from": f"{resend_from_name} <{resend_from_email}>",
269
  "to": [to_email],
270
  "subject": subject,
271
  "html": html_body,
 
456
  logger.info("Kein RESEND_API_KEY – Lead-Benachrichtigung übersprungen.")
457
  return
458
 
459
+ resend_from_name = os.environ.get("RESEND_FROM_NAME", "Elite")
460
+ resend_from_email = os.environ.get("RESEND_FROM_EMAIL", "elite@webstark.org")
461
+
462
  try:
463
  async with aiohttp.ClientSession() as session:
464
  await session.post(
 
466
  headers={
467
  "Authorization": f"Bearer {resend_key}",
468
  "Content-Type": "application/json",
469
+ "Accept-Encoding": "identity",
470
  },
471
  json={
472
+ "from": f"{resend_from_name} <{resend_from_email}>",
473
  "to": [notify_email],
474
  "subject": f"🔥 Neuer Lead: {lead_data['name']} – {lead_data['interest']}",
475
  "html": f"""
 
495
  if not resend_key:
496
  return
497
 
498
+ resend_from_name = os.environ.get("RESEND_FROM_NAME", "Elite")
499
+ resend_from_email = os.environ.get("RESEND_FROM_EMAIL", "elite@webstark.org")
500
+
501
  try:
502
  async with aiohttp.ClientSession() as session:
503
  await session.post(
 
505
  headers={
506
  "Authorization": f"Bearer {resend_key}",
507
  "Content-Type": "application/json",
508
+ "Accept-Encoding": "identity",
509
  },
510
  json={
511
+ "from": f"{resend_from_name} <{resend_from_email}>",
512
  "to": [notify_email],
513
  "subject": f"📝 Gesprächs-Zusammenfassung: {summary['customer_name']}",
514
  "html": f"""