Hi .... Sorry for responding after a long time, but today i tried the script above but unfortunately it failed, i think there is something wrong in the SMTPaddress ... look at what i did :
Code
MailProfil = New InternetMailProfile;
MailProfil.SMTPServerAddress = "mail.gmail.com";
MailProfil.SMTPAuthentication = SMTPAuthenticationMode.Default;
MailProfil.Timeout = 60;
MailProfil.SMTPPassword = "########"; // here i put the sender password
MailProfil.SMTPUser = "mohammad.maleh@gmail.com";// here i put the sender Email
send = New InternetMailMessage;
send.To.Add("mohammad.maleh@gmail.com"); // here i put the receiver email
send.From.Address = "mohammad.maleh@gmail.com";
send.Subject = "New message";
send.Texts.Add("Context of messsage");
mail = New InternetMail;
mail.Logon(MailProfil);
mail.Send(send);
mail.Logoff();
Hi ... I've made a software that sends emails when a form is closed ... but the form freezes before closing for 5-6 seconds while sending ... and that bothers the users ... is there any way to make it work quicker ?!! and thanks in advance
I do it by saving message and other information of email to Catalog (or another storage of 1C), and then send not processings elements by Scheduled jobs
I have read code in Subsystem Library 2.0 but I could not find Listing 3 GenerateInternetProfile function in EmailAccounts catalogs that you posted above. Pls help me to understand.
Function ReadEmails()
MailProfile = New InternetMailProfile;
MailProfile.IMAPServerAddress = "imap.server.com";
MailProfile.IMAPPort = 993;
MailProfile.IMAPUser = "username";
MailProfile.IMAPPassword = "password";
Mail = New InternetMail;
Mail.Logon(MailProfile, InternetMailProtocol.IMAP);
structureSelectionOptions = New Structure;
structureSelectionOptions.Insert("Seen", False);
headers = Mail.GetHeaders(structureSelectionOptions);
If headers.Count() > 0 Then
arrayMessages = New Array;
arrayMessages = Mail.Get(False, headers, True);
For i = 0 По arrayMessages.Count() - 1 Do
EndDo;
EndIf;
EndFunction
Thanks Aleksandr Biryukov, I read one of your posts(https://1c-dn.com/blog/work-with-http-services-in-1c-part-2-post-method/) and I am having a problem and would like your help. Now, I have a task API. I have to create POST method to get data from web page size. do you have any suggestions for me, or a document that helps me do that. Thank you so much.