Email using Sendgrid

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Jun 13, 2023
Company: Logisoft

Good Morning,

I am having an issue by sending emails from 8.3.10.2168 after 07/06/2023. Previously I was using the following code without any issues but after that date i am getting the following error:
"This operation cannot be performed because no SMTP server address has been specified."

MailMessage = New InternetMailMessage;
MailMessage.To.Add(<To Email Address>);
MailMessage.From.Address = <From Email Address>;
MailMessage.Subject = <Subject Name>;
text=<General Text>;
MailMessage.Texts.Add(text);  


Profile = New InternetMailProfile;
Profile.SMTPPassword=<SMTP Password>;
Profile.SMTPPort=587;
Profile.SMTPServerAddress="smtp.sendgrid.net";
Profile.SMTPAuthentication= smtpauthenticationmode.Default;
Profile.SMTPUser=<SMTP User>;

Mail = New InternetMail;
Mail.Logon(Profile);

Mail.Send(MailMessage);

Do know how to resolve this error?

 
#2
People who like this:0Yes/0No
Administrator
Rating: 24
Joined: Oct 3, 2019
Company:

Hello Petros,

perhaps the reason is that the settings of your mail server have changed.

Try the following code:

Code
Profile = New InternetMailProfile;

Profile.SMTPPort = 587;
Profile.IMAPPort = 0;
Profile.POP3Port = 0;

Profile.POP3BeforeSMTP    = False;
Profile.IMAPServerAddress = "";
Profile.POP3ServerAddress = "";
Profile.SMTPServerAddress = "smtp.sendgrid.net";

Profile.POP3Authentication = POP3AuthenticationMode.General;
Profile.SMTPAuthentication = SMTPAuthenticationMode.Default

Profile.IMAPUseSSL = False;
Profile.POP3UseSSL = False;
Profile.SMTPUseSSL = True;

Profile.Password    = "";
Profile.IMAPPassword   = "";
Profile.SMTPPassword   = <SMTP Password>;

Profile.User       = "";
Profile.IMAPUser    = "";
Profile.SMTPUser   = <SMTP User>;

Profile.Timeout = 30;

Profile.IMAPSecureAuthenticationOnly = False;
Profile.POP3SecureAuthenticationOnly = False;
Profile.SMTPSecureAuthenticationOnly = False;

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.