Site icon Renzo Mischianti

Email Sender not working again

It was working for the longest time, but has not been working again - likely for the past 2 weeks (Only noticed now) When trying to run, I get the following outputs (Debug Print turned on, and some debug prints of my own)

EmailSendFrom=Test123@mydomain.com
Test123@mydomain.com
Server=exch6.mydomain.com
exch6.mydomain.com
Port=587
Send to Email=anyemail@adomain.com
anyemail@adomain.com
In email routine
ONLY ONE RECIPIENTmiltiple destination and attachments
Insecure client:0
exch6.mydomain.com
587
220 EXCH6.MYDOMAIN.COM Microsoft ESMTP MAIL Service ready at Wed, 4 Jan 2023 15:31:51 -0500
EHLO mischianti 
501 5.5.4 Invalid domain name
Sending status: 
0
250
Identification error (501 5.5.4 Invalid domain name)
The code to send is the following

  String str_ea = EWSetup.getSetupEmailAddr();
  String str_ep = EWSetup.getSetupPassword();
  String str_easf = EWSetup.getSetupEmailAddr();
  String str_es = EWSetup.getExchServerIPFQDN();
  String str_ste = EWSetup.getSendToEmail();

  const char* ea = str_ea.c_str();
  const char* ep = str_ep.c_str();
  const char* easf = str_easf.c_str();
  const char* es = str_es.c_str();
  int smtpPort = EWSetup.getSetupSMTPPort();
  const char* ste = str_ste.c_str();

  SerDebug(F("EmailAddr="));
  SerDebugln(EWSetup.getSetupEmailAddr());
  SerDebugln(String(ea));

  SerDebug(F("EmailPassword="));
  SerDebugln(EWSetup.getSetupPassword());
  SerDebugln(String(ep));

  SerDebug(F("EmailSendFrom="));
  SerDebugln(EWSetup.getSetupEmailAddr());
  SerDebugln(String(easf));

  SerDebug(F("Server="));
  SerDebugln(EWSetup.getExchServerIPFQDN());
  SerDebugln(String(es));

  SerDebug(F("Port="));
  SerDebugln(smtpPort);

  SerDebug(F("Send to Email="));
  SerDebugln(EWSetup.getSendToEmail());
  SerDebugln(String(ste));

  EMailSender emailSend(ea, ep, easf, es, smtpPort);

  SerDebugln(F("In email routine"));
  emailSend.setEHLOCommand(true);
  EMailSender::EMailMessage msg;
  msg.subject = emailSubject;
  msg.message = emailMessage;

  EMailSender::Response resp = emailSend.send(ste, msg);

  SerDebugln(F("Sending status: "));

  SerDebugln(resp.status);
  SerDebugln(resp.code);
  SerDebugln(resp.desc);

  return (resp.status);
Any ideas?
Exit mobile version