🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1467

Re: I am using NMSMTP, how do I set up the "sent date".

#1467
From: Steve Westwood
Date: Wed, 12 Jan 2005 21:06
88 lines
3883 bytes
Thank you.   But what is OffsetFromUTC




"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:41e2c814$1@newsgroups.borland.com...
>
> "Steve Westwood" <S-Westwood@RCN.COM> wrote in message
> news:41e288a7$1@newsgroups.borland.com...
>
>> I thought it should have been:
>>   NMSMTP1->PostMessageA->Date = Now();
>
> Date is a string, whereas Now() returns a TDateTime instead.  E-mail dates
> must be formatted in a special way.  The default TDateTime-to-String
> conversion does not use the proper format at all.  You would have to 
> convert
> the TDateTime manually, ie:
>
>    AnsiString __fastcall GetGMTOffsetStr()
>    {
>        int iBias:
>        TIME_ZONE_INFORMATION tmez = {0};
>
>        switch( GetTimeZoneInformation(&tmez) )
>        {
>            case TIME_ZONE_ID_INVALID:
>                throw Exception();
>                break;
>            case TIME_ZONE_ID_UNKNOWN:
>                iBias = tmez.Bias;
>                break;
>            case TIME_ZONE_ID_DAYLIGHT:
>                iBias = (tmez.Bias + tmez.DaylightBias);
>                break;
>            case TIME_ZONE_ID_STANDARD:
>                iBias = (tmez.Bias + tmez.StandardBias);
>                break;
>            default:
>                throw Exception();
>                break;
>        }
>
>        TDateTime dt = EncodeTime(abs(iBias) / 60, abs(iBias) % 60, 0, 0);
>        if( iBias > 0 )
>            dt = (0 - dt);
>
>        WORD wHour, wMin, wSec, wMSec;
>        dt.DecodeTime(&wHour, &wMin, &wSec, &wMSec);
>
>        AnsiString Result = Format(" %0.2d%0.2d", ARRAYOFCONST(( wHour,
> wMin )) );
>        if( OffsetFromUTC < 0.0 )
>            Result[1] = '-';
>        else
>            Result[1] = '+';
>
>        return Result;
>    }
>
>    AnsiString __fastcall DateTimeToInternetStr(const TDateTime &AValue)
>    {
>        static char* wdays[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri",
> "Sat"};
>        static char* monthnames[12] = {"Jan", "Feb", "Mar", "Apr", "May",
> "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
>
>        WORD wYear, wMonth, wDay;
>        AValue.DecodeDate(&wYear, &wMonth, &wDay);
>
>        return Format("%s, %d %s %d %s %s",
>                ARRAYOFCONST(( wdays[AValue.DayOfWeek()-1], wDay,
> monthnames[wMonth-1],
>                        wYear, AValue.FormatString("HH:NN:SS"),
> GetGMTOffsetStr() )) );
>    }
>
>    NMSMTP1->PostMessageA->Date = DateTimeToInternetStr(Now());
>
>
> In any case, I would suggest not using TNMSMTP at all.  The NetMasters
> components are notoriously buggy and problematic in general.
>
>
> Gambit
>
> 
Technical Details
Message-ID: <41e59169@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41e288a7$1@newsgroups.borland.com> <41e2c814$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,ecf8d057ce6c4cc5
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Steve Westwood" <S-Westwood@RCN.COM>
Newsgroups: borland.public.cppbuilder.internet.web
References: <41e288a7$1@newsgroups.borland.com> <41e2c814$1@newsgroups.borland.com>
Subject: Re: I am using NMSMTP, how do I set up the "sent date".
Date: Wed, 12 Jan 2005 16:06:42 -0500
Lines: 90
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 216.178.73.21
Message-ID: <41e59169@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105564009 216.178.73.21 (12 Jan 2005 13:06:49 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.multikabel.nl!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail