nopSolutions/nopCommerce · warning · NopException
Sender email is not valid
Error message
Sender email is not valid
What it means
Thrown in the GiftCard NotifyRecipient action when the persisted giftCard.SenderEmail fails CommonHelper.IsValidEmail. This checks the sender email stored on the gift card (set at creation/purchase), not a posted form value. NopException, caught and shown as an error notification.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/GiftCardController.cs:219
}
[HttpPost, ActionName("Edit")]
[FormValueRequired("notifyRecipient")]
[CheckPermission(StandardPermission.Orders.GIFT_CARDS_CREATE_EDIT_DELETE)]
public virtual async Task<IActionResult> NotifyRecipient(GiftCardModel model)
{
//try to get a gift card with the specified id
var giftCard = await _giftCardService.GetGiftCardByIdAsync(model.Id);
if (giftCard == null)
return RedirectToAction("List");
try
{
if (!CommonHelper.IsValidEmail(giftCard.RecipientEmail))
throw new NopException("Recipient email is not valid");
if (!CommonHelper.IsValidEmail(giftCard.SenderEmail))
throw new NopException("Sender email is not valid");
var languageId = 0;
var order = await _orderService.GetOrderByOrderItemAsync(giftCard.PurchasedWithOrderItemId ?? 0);
if (order != null)
{
var customerLang = await _languageService.GetLanguageByIdAsync(order.CustomerLanguageId) ?? (await _languageService.GetAllLanguagesAsync()).FirstOrDefault();
if (customerLang != null)
languageId = customerLang.Id;
}
else
{
languageId = _localizationSettings.DefaultAdminLanguageId;
}
var queuedEmailIds = await _workflowMessageService.SendGiftCardNotificationAsync(giftCard, languageId);
if (queuedEmailIds.Any())
{View on GitHub (pinned to 64bdf2ff08)
Solutions
- Correct the SenderEmail on the gift card record, then retry.
- Trace the purchase/creation path that wrote the sender email and ensure it validates against a valid customer email.
- Add IsValidEmail validation at gift-card creation to prevent future bad data.
- For bulk operations, pre-filter gift cards whose SenderEmail is invalid.
Example fix
// before — notify fails because stored sender email is invalid
throw new NopException("Sender email is not valid");
// after — guard before attempting notification
if (!CommonHelper.IsValidEmail(giftCard.SenderEmail))
{
_notificationService.ErrorNotification("Sender email on this gift card is invalid; please correct it first.");
return RedirectToAction("Edit", new { id = giftCard.Id });
} Defensive patterns
Strategy: validation
Validate before calling
// Before notifying: validate the stored sender email
if (!CommonHelper.IsValidEmail(giftCard.SenderEmail))
{
_notificationService.ErrorNotification("Sender email on this gift card is invalid; correct it before notifying.");
return RedirectToAction("Edit", new { id = giftCard.Id });
} Type guard
bool HasValidSenderEmail(GiftCard gc) => CommonHelper.IsValidEmail(gc?.SenderEmail);
Try / catch
// NotifyRecipient's try/catch shows exc.Message; pre-check both sender and recipient emails before sending.
Prevention
- Ensure the purchasing customer's email is validated before creating a gift card.
- Validate SenderEmail at creation time, not just at notify time.
- Pre-screen gift cards in bulk operations for invalid sender/recipient emails.
When it happens
Trigger: POST to GiftCard/NotifyRecipient for a gift card whose SenderEmail column holds an invalid or empty address — reached only after the recipient email check passes.
Common situations: Gift cards created by a customer whose email was malformed or null in the customer record at purchase time; seed/migration data with blank sender emails; a customized gift-card creation flow that bypassed sender-email validation.
Related errors
- Recipient email is not valid
- Email is not valid.
- You cannot delete this email account. At least one account i
- Template cannot be loaded
- Enter test email address
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/b6fc616188e98036.
Report an issue: GitHub.