Code unit 'Mail'

fezih5
Member Posts: 12
Hi all. Am sending customer statements by email to my clients. My Qs is about the body part of the email.
QS: I need to separate body texts in to paragraps. Am told reference codeunit MAIL.Function=AddBodyLine.
Now how do i manage this? Thanx
:?
QS: I need to separate body texts in to paragraps. Am told reference codeunit MAIL.Function=AddBodyLine.
Now how do i manage this? Thanx
:?
0
Comments
-
If you are using SMTP mailing, you can send the mail as HTML and use '<br>' as end of line etc.
In common mail you can try to add character '\' as a new line...0 -
I'm using Microsoft CDO For Exchange 2000 Library.
Try this, it is not last version, but you'll find out the way.PROCEDURE SendSMTP@1000000002(Sender@1000000000 : Text[50];From@1000000001 : Text[50];RcpTo@1000000002 : Text[50];Cc@1000000016 : Text[50];Bcc@1000000017 : Text[50];SMTPServer@1000000003 : Text[50];Subject@1000000004 : Text[150];HTMLBody@1000000005 : Variant;TextBody@1000000006 : Variant); VAR Mail@1000000015 : Automation "{CD000000-8B95-11D1-82DB-00C04FB1625D} 1.0:{CD000001-8B95-11D1-82DB-00C04FB1625D}:'Microsoft CDO For Exchange 2000 Library'.Message"; Config@1000000014 : Automation "{CD000000-8B95-11D1-82DB-00C04FB1625D} 1.0:{CD000022-8B95-11D1-82DB-00C04FB1625D}:'Microsoft CDO For Exchange 2000 Library'.IConfiguration"; Fields@1000000013 : Automation "{00000205-0000-0010-8000-00AA006D2EA4} 2.5:{00000564-0000-0010-8000-00AA006D2EA4}:'Microsoft ActiveX Data Objects 2.5 Library'.Fields"; Field@1000000012 : Automation "{00000205-0000-0010-8000-00AA006D2EA4} 2.5:{00000569-0000-0010-8000-00AA006D2EA4}:'Microsoft ActiveX Data Objects 2.5 Library'.Field"; ItemIndex@1000000008 : Variant; ItemVal@1000000007 : Variant; BEGIN CLEARALL ; IF ISCLEAR(Mail) THEN CREATE(Mail) ; Config := Mail.Configuration ; Fields := Config.Fields ; ItemIndex := 'http://schemas.microsoft.com/cdo/configuration/SendUsing' ; ItemVal := '2' ; Field := Fields.Item(ItemIndex) ; Field.Value := ItemVal ; ItemIndex := 'http://schemas.microsoft.com/cdo/configuration/smtpserver' ; ItemVal := SMTPServer ; Field := Fields.Item(ItemIndex) ; Field.Value := ItemVal ; ItemIndex := 'http://schemas.microsoft.com/cdo/configuration/smtpserverport' ; ItemVal := '25' ; Field := Fields.Item(ItemIndex) ; Field.Value := ItemVal ; ItemIndex := 'http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout' ; ItemVal := '1' ; Field := Fields.Item(ItemIndex) ; Field.Value := ItemVal ; Fields.Update ; Mail.From := From ; Mail.Sender := Sender ; Mail."To" := RcpTo ; Mail.CC := Cc ; Mail.BCC := Bcc ; Mail.Subject := Subject ; IF NOT ISCLEAR(HTMLBody) THEN Mail.HTMLBody := HTMLBody ELSE Mail.TextBody := TextBody ; Mail.Send ; CLEARALL ; END;
I'm using this for notification of sucessfull import of exchange rates.IF CurrExchangeRate.INSERT THEN BEGIN HTMLBody := HTMLBody + '<b>' + CurrExchangeRate."Currency Code" + '</b>(' +CurrExchangeRate.ISO+') - 1 EUR='+ FORMAT( CurrExchangeRate."Exchange Rate Amount" ) + '<p>' ; END ; ... ... SendSMTP('me','me@company.si','cc@company.si','me@company.si','', 'mail.company.si','Exchange rates for '+FORMAT(CurrExchangeRate."Starting Date")+' are imported'),HTMLBody,'') ;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions