Announcement

Collapse
No announcement yet.

Datumsproblem beim Mailversand

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Datumsproblem beim Mailversand

    Hallo zusammen,<br>
    stimmt es, dass das SMTP Datumsformat immer in englischer Notation erfolgen muss?<br>
    Also: <b>Mon, 2 Dec 2002 12:16:22 +0100</b>
    <p>Wenn ich versuche mit FormatDateTime einen entsprechenden Datumsstring zusammen zu setzen wird natürlich die jeweilige Landeseinstellung verwendet und das SMTP Absende Datum kann vom Mailclient nicht mehr Interpretiert werden.</p>
    Gruß Andreas

  • #2
    Is mir so noch nich aufgefallen. Aber warum baust du dir nich das Datum auf deine Art zusammen?
    <pre>
    <DIV><FONT face="Courier New" size=2><FONT color=#000000><FONT
    face="Courier New" size=2><FONT color=#000000><B>uses </B>...,&nbsp;DateUtils;<BR><BR>...<BR><BR><B>functi on</B>&nbsp;BuildCurDate:&nbsp;<B>string</B>;<BR><B>const</B><BR>&nbsp;&nbsp;myDaysOfWeek:&nbsp;<B>array</B>[1..7]&nbsp;<B>of</B>&nbsp;<B>string</B>&nbsp;=<BR>&nbsp;&nbsp;(<FONT
    face="Courier New" size=2><FONT color=#800080>'Sun'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Mon'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Tue'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Wed'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Thu'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Fri'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>'Sat'</FONT>);<BR>&nbsp;&nbsp;myMonthsOfYear:&nbsp;<B>arr ay</B>[1..12]&nbsp;<B>of</B>&nbsp;<B>string</B>&nbsp;=<BR>&nbsp;&nbsp;(<FONT
    face="Courier New" size=2><FONT color=#800080>'Jan'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Feb'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Mar'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Apr'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'May'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT color=#800080>'Jun'</FONT>,&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>'Jul'</FONT>,<BR>&nbsp;&nbsp;&nbsp;&nbsp;<FONT face="Courier New"
    size=2><FONT color=#800080>'Aug'</FONT>,&nbsp;<FONT face="Courier New"
    size=2><FONT color=#800080>'Sep'</FONT>,&nbsp;<FONT face="Courier New"
    size=2><FONT color=#800080>'Oct'</FONT>,&nbsp;<FONT face="Courier New"
    size=2><FONT color=#800080>'Nov'</FONT>,&nbsp;<FONT face="Courier New"
    size=2><FONT
    color=#800080>'Dec'</FONT>);<BR><B>var</B><BR>&nbsp;&nbsp;s:&nbsp;<B>string</B>;<BR><B>begin</B><BR>&nbsp;&nbsp;DateTimeToString(s,&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>'d'</FONT>,&nbsp;Date);<BR>&nbsp;&nbsp;<B>if</B>&nbsp;(Length(s)&nbsp;=&nbsp;1)&nbsp;<B>then</B>&nbsp;s&nbsp;:=&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>'&nbsp;'</FONT>&nbsp;+&nbsp;s;<BR>&nbsp;&nbsp;Result&nbsp;:= &nbsp;myDaysOfWeek[DayOfWeek(Date)]&nbsp;+&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>',&nbsp;'</FONT>&nbsp;+&nbsp;s&nbsp;+&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>'&nbsp;'</FONT>&nbsp;+<BR>&nbsp;&nbsp;&nbsp;&nbsp;myMonthsOf Year[MonthOfTheYear(Date)]&nbsp;+&nbsp;<FONT
    face="Courier New" size=2><FONT
    color=#800080>'&nbsp;'</FONT>&nbsp;+&nbsp;inttostr(YearOf(Date));<BR><B>en d</B>;<BR></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></DIV></pre>

    Grüße, Mari

    Comment


    • #3
      Ja schon Mario,<br>aber die Frage ist ja, ob generell nur das englische Format für SMTP verwendet wird oder ob es länderunabhängig ist.<br>
      Ich verwende NetMaster Komponenten vielleicht hat ja jemand INDY und kann mal im Code nach der Property Date (oder so) schauen. Vielleicht gibt's bei INDY eine entsprechende Initialisierung die Aufschluss darüber gibt.<br>Gruss Andrea

      Comment


      • #4
        <P>N'abend </P>
        <P>Hab mal im Source von den Indy-Komponenten gestöbert.&nbsp;Die
        SMTP-Komponente konvertiert das (aktuelle) Datum per <FONT face="Courier New"
        size=2><FONT color=#000000><FONT face="Courier New" size=2><FONT
        color=#000000>DateTimeToInternetStr()</FONT></FONT></FONT></FONT>in einen
        String.<BR><BR>Auszug aus dem Source:<BR><BR><FONT face="Courier New"
        size=2><FONT color=#000000><FONT face="Courier New" size=2><FONT
        color=#000000>...<BR><B>if</B>&nbsp;UseNowForDate&nbsp;<B>then</B>&nbsp;<B>begin</B><BR>&nbsp;&nbsp;Values[<FONT
        face="Courier New" size=2><FONT
        color=#800080>'Date'</FONT>]&nbsp;:=&nbsp;DateTimeToInternetStr(Now);&nbsp;<FO NT
        face="Courier New" color=#000080
        size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR><B>end</B><BR><B>else</B>&nbsp;<B>begin</B><BR>&nbsp;&nbsp;Values[<FONT
        face="Courier New" size=2><FONT
        color=#800080>'Date'</FONT>]&nbsp;:=&nbsp;DateTimeToInternetStr(Self.Date);&nb sp;<FONT
        face="Courier New" color=#000080
        size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR><B>end</B>;<BR>...<BR></FONT></FONT></FONT></FONT></FONT></FONT></P>
        Grüße, Mari

        Comment


        • #5
          Moin,<br>
          was macht denn <b>DateTimeToÌnternetStr</b> is ja wohl ne Indy function...<p>gruß Andreas</p&gt

          Comment


          • #6
            Yup, Unit idGlobal. Hatte ich übersehen.

            <FONT face="Courier New" size=2><FONT color=#000000><FONT face="Courier New"
            size=2><FONT color=#000000><FONT face="Courier New" color=#000080
            size=2><I>{This&nbsp;should&nbsp;never&nbsp;be&nbs p;localized}</I></FONT><BR><BR><B>function</B>&nbsp;OffsetFromUTC:&nbsp;TDateTime;<BR><B>var</B><BR>&nbsp;&nbsp;iBias:&nbsp;Integer;<BR>&nbsp;&n bsp;tmez:&nbsp;TTimeZoneInformation;<BR><B>begin</B><BR>&nbsp;&nbsp;<B>case</B>&nbsp;GetTimeZoneInformation(tmez)&nbsp;<B>of</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;TIME_ZONE_ID_INVALID :&nbsp;;<BR><FONT
            face="Courier New" color=#000080
            size=2><I>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise&nbsp;EId FailedToRetreiveTimeZoneInfo.Create(RSFailedTimeZo neInfo);</I></FONT><BR>&nbsp;&nbsp;&nbsp;&nbsp;TIME_ZONE_ID_UNKN OWN:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iBias& nbsp;:=&nbsp;tmez.Bias;<BR>&nbsp;&nbsp;&nbsp;&nbsp ;TIME_ZONE_ID_DAYLIGHT:<BR>&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;iBias&nbsp;:=&nbsp;tmez.Bias&nbsp;+&n bsp;tmez.DaylightBias;<BR>&nbsp;&nbsp;&nbsp;&nbsp; TIME_ZONE_ID_STANDARD:<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;iBias&nbsp;:=&nbsp;tmez.Bias&nbsp;+&nb sp;tmez.StandardBias;<BR>&nbsp;&nbsp;<B>else</B>&nbsp;;<BR>&nbsp;&nbsp;&nbsp;<FONT
            face="Courier New" color=#000080
            size=2><I>//&nbsp;raise&nbsp;EIdFailedToRetreiveTimeZoneInfo.C reate(RSFailedTimeZoneInfo);</I></FONT><BR>&nbsp;&nbsp;<B>end</B>;<BR>&nbsp;&nbsp;Result&nbsp;:=&nbsp;EncodeTime( Abs(iBias)&nbsp;<B>div</B>&nbsp;60,&nbsp;Abs(iBias)&nbsp;<B>mod</B>&nbsp;60,&nbsp;0,&nbsp;0);<BR>&nbsp;&nbsp;<B>if </B>&nbsp;iBias&nbsp;&gt;&nbsp;0&nbsp;<B>then</B>&nbsp;<B>begin</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;Result&nbsp;:=&nbsp; 0&nbsp;-&nbsp;Result;<BR>&nbsp;&nbsp;<B>end</B>;<BR><B>end</B>;<BR></FONT></FONT></FONT></FONT><FONT
            face="Courier New" size=2><FONT color=#000000><FONT face="Courier New"
            size=2><FONT color=#000000><BR></FONT></FONT></FONT></FONT><FONT
            face="Courier New" size=2><FONT color=#000000><FONT face="Courier New"
            size=2><FONT
            color=#000000><B>function</B>&nbsp;DateTimeToGmtOffSetStr(ADateTime:&nbsp;TDa teTime;&nbsp;SubGMT:&nbsp;Boolean):&nbsp;<B>string </B>;<BR><B>var</B><BR>&nbsp;&nbsp;AHour,&nbsp;AMin,&nbsp;ASec,&nbs p;AMSec:&nbsp;Word;<BR><B>begin</B><BR>&nbsp;&nbsp;<B>if</B>&nbsp;(ADateTime&nbsp;=&nbsp;0.0)&nbsp;<B>and</B>&nbsp;SubGMT&nbsp;<B>then</B>&nbsp;<B>begin</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;Result&nbsp;:=&nbsp; <FONT
            face="Courier New" size=2><FONT color=#800080>'GMT'</FONT>;&nbsp;<FONT
            face="Courier New" color=#000080
            size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR>&nbsp;&nbsp;&nbsp;&nbsp;Exit;<BR>&nbsp;&n bsp;<B>end</B>;<BR>&nbsp;&nbsp;DecodeTime(ADateTime,&nbsp;AHou r,&nbsp;AMin,&nbsp;ASec,&nbsp;AMSec);<BR>&nbsp;&nb sp;Result&nbsp;:=&nbsp;Format(<FONT
            face="Courier New" size=2><FONT
            color=#800080>'&nbsp;%0.2d%0.2d'</FONT>,&nbsp;[AHour,&nbsp;AMin]);&nbsp;<FONT
            face="Courier New" color=#000080
            size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR>&nbsp;&nbsp;<B>if</B>&nbsp;ADateTime&nbsp;&lt;&nbsp;0.0&nbsp;<B>then </B>&nbsp;<B>begin</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;Result[1]&nbsp;:=&nbsp;<FONT
            face="Courier New" size=2><FONT color=#800080>'-'</FONT>;&nbsp;<FONT
            face="Courier New" color=#000080
            size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR>&nbsp;&nbsp;<B>end</B><BR>&nbsp;&nbsp;<B>else</B>&nbsp;<B>begin</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;Result[1]&nbsp;:=&nbsp;<FONT
            face="Courier New" size=2><FONT color=#800080>'+'</FONT>;&nbsp;<FONT
            face="Courier New" color=#000080
            size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR>&nbsp;&nbsp;<B>end</B>;<BR><B>end</B>;<BR></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT> ..

            Comment


            • #7
              ...
              <FONT face="Courier New" size=2><FONT color=#000000><FONT face="Courier New"
              size=2><FONT
              color=#000000><B>function</B>&nbsp;DateTimeToInternetStr(<B>const</B>&nbsp;Value:&nbsp;TDateTime):&nbsp;<B>string</B>;<BR><B>const</B><BR>&nbsp;&nbsp;wdays:&nbsp;<B>array</B>[1..7]&nbsp;<B>of</B>&nbsp;<B>string</B>&nbsp;=&nbsp;(<FONT
              face="Courier New" size=2><FONT color=#800080>'Sun'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Mon'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Tue'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Wed'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Thu'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT
              color=#800080>'Fri'</FONT>,<BR>&nbsp;&nbsp;&nbsp;&nbsp;<FONT face="Courier New"
              size=2><FONT color=#800080>'Sat'</FONT>);&nbsp;<FONT face="Courier New"
              color=#000080
              size=2><I>{&nbsp;do&nbsp;not&nbsp;localize&nbsp;}</I></FONT><BR>&nbsp;&nbsp;monthnames:&nbsp;<B>array</B>[1..12]&nbsp;<B>of</B>&nbsp;<B>string</B>&nbsp;=&nbsp;(<FONT
              face="Courier New" size=2><FONT color=#800080>'Jan'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Feb'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Mar'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Apr'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'May'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT
              color=#800080>'Jun'</FONT>,<BR>&nbsp;&nbsp;&nbsp;&nbsp;<FONT face="Courier New"
              color=#000080
              size=2><I>{&nbsp;do&nbsp;not&nbsp;localize&nbsp;}</I></FONT><BR>&nbsp;&nbsp;&nbsp;&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Jul'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Aug'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Sep'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Oct'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Nov'</FONT>,&nbsp;<FONT
              face="Courier New" size=2><FONT color=#800080>'Dec'</FONT>);&nbsp;<FONT
              face="Courier New" color=#000080
              size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR><B>var</B><BR>&nbsp;&nbsp;wDay,<BR>&nbsp;&nbsp;&nbsp;&nbsp ;wMonth,<BR>&nbsp;&nbsp;&nbsp;&nbsp;wYear:&nbsp;Wo rd;<BR><B>begin</B><BR>&nbsp;&nbsp;DecodeDate(Value,&nbsp;wYear,&nb sp;wMonth,&nbsp;wDay);<BR>&nbsp;&nbsp;Result&nbsp; :=&nbsp;Format(<FONT
              face="Courier New" size=2><FONT
              color=#800080>'%s,&nbsp;%d&nbsp;%s&nbsp;%d&nbsp;%s &nbsp;%s'</FONT>,&nbsp;<FONT
              face="Courier New" color=#000080
              size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR>&nbsp;&nbsp;&nbsp;&nbsp;[wdays[DayOfWeek(Value)],&nbsp;wDay,&nbsp;monthnames[wMonth],<BR>&nbsp;&nbsp;&nbsp;&nbsp;wYear,&nbsp;FormatDat eTime(<FONT
              face="Courier New" size=2><FONT
              color=#800080>'hh:nn:ss'</FONT>,&nbsp;Value),&nbsp;<FONT face="Courier New"
              color=#000080
              size=2><I>{do&nbsp;not&nbsp;localize}</I></FONT><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DateT imeToGmtOffSetStr(OffsetFromUTC,&nbsp;False)]);<BR><B>end</B>;<BR></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT>

              Grüße, Mario :

              Comment


              • #8
                Joo Mario Danke...<br>
                Scheinbar ist Email in gewisser weise doch nicht länderunabhängig *<

                Comment

                Working...
                X