For example I tried it on a button on the item card that quickly creates an email of the item details and attaches a picture.MailOCX.LineFeedChar := '';
MailOCX.InitializeMail('Your Email Subject');
MailOCX.AddReceiverTo('youremail1-at-yourdomain.net');
MailOCX.AddReceiverCC('youremail2-at-yourdomain.net');
MailOCX.AddReceiverBCC('youremail3-at-yourdomain.net');
MailOCX.AddtoBody(FieldValue.SubstituteLine(EMailBodyLine));
MailOCX.AddAttachment(TempFilename);
MailOCX.Send(FALSE); //false = send automatically
User.GET(USERID); CALCFIELDS(Picture); IF Picture.HASVALUE THEN BEGIN EmailSubject := 'Please Update: Item '+"No."+' Picture Attached'; EmailBody := 'Item '+"No."+' Picture Attached'; TempFileName := 'P:\jpg\'+"No."+'.jpg'; MailOCX.LineFeedChar := ''; MailOCX.InitializeMail(EmailSubject); MailOCX.AddReceiverTo(User."User Email Address"); MailOCX.AddtoBody('Item#: '+"No."+'\'); //note baskslash forces new line in body MailOCX.AddtoBody(Description+' '+"Description 2"+'\'); MailOCX.AddtoBody('UPC: '+"Item UPC/EAN Number"); MailOCX.AddAttachment(TempFileName); MailOCX.Send(TRUE); //creates email but doesn't send until user sends END;
OnDelete() SendMail; SendMail() User.GET(USERID); MailOCX.LineFeedChar := ''; MailOCX.InitializeMail('Sales Invoice Deletion Attempt'); MailOCX.AddReceiverTo('youremail1-at-yourdomain.net'); MailOCX.AddReceiverCC('youremail2-at-yourdomain.net'); MailText := 'Date:'+FORMAT(TODAY)+' '+'Time:'+FORMAT(TIME)+' '+'User:'+FORMAT(User."User ID")+' '+'Invoice#:'+FORMAT("No."); MailOCX.AddtoBody(MailText); MailOCX.Send(FALSE); CLEAR(MailOCX);