July 2, 2024, 2:53 p.m. | Michele Mazzucchi

DEV Community dev.to

When you build a web application you need to email your users for password resets, orders placed and the like.


A trivial task, it seems. Here's a one-liner in django:



from django.core.mail import send_mail

send_mail("Password changed!",
f"Hey {request.user.first_name}!\n\nYour password changed...",
"support@yourservice.com",
[request.user.email],
fail_silently=False)





Reality kicks in

A one-liner. Problem solved, now moving on.


But soon after, issues arise:



  1. You want to include some special characters like '🙂' or 'schön'. The one-liner no longer works.

  2. You need some conditional …

application build com django email hey import mail moving moving on notifications password problem python reality request sms support task web web application

Senior Software Java Developer

@ Swiss Re | Madrid, M, ES

Product Owner (Hybrid) - 19646

@ HII | Fort Belvoir, VA, Virginia, United States

Sr. Operations Research Analyst

@ HII | Albuquerque, NM, New Mexico, United States

Lead SME Platform Architect

@ General Dynamics Information Technology | USA VA Falls Church - 3150 Fairview Park Dr (VAS095)

DevOps Engineer (Hybrid) - 19526

@ HII | San Antonio, TX, Texas, United States

Cloud Platform Engineer (Hybrid) - 19535

@ HII | Greer, SC, South Carolina, United States