Thread Sendmail für Windows (18 answers)
Opened by Drain at 2003-08-22 15:57

renee
 2003-08-29 12:12
#1222 #1222
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Ich habe die das Readme von Blat aufgetrieben und da heisst es:

syntax:
 Blat <filename> -t <recipient> [optional switches (see below)]
 Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]] [-q]
 Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q]
 Blat -h [-q]

-install <server addr> <sender's addr> [<try n times> [<port> [<profile>]]]
    : set's SMTP server, sender, number of tries and port for profile
      (<try n times> and <port> may be replaced by '-' ).

<filename>     : file with the message body ('-' for console input, end with ^Z)
-t <recipient> : recipient list (comma separated)
-s <subj>      : subject line
-f <sender>    : overrides the default sender address (must be known to server)
-i <addr>      : a 'From:' address, not necessarily known to the SMTP server.
-c <recipient> : carbon copy recipient list (comma separated)
-b <recipient> : blind carbon copy recipient list (comma separated)
-o <organization>: Organization field
-x <X-Header: detail>: Custom 'X-' header.  eg: -x "X-INFO: Blat is Great!"
-r             : Request return receipt.
-d             : Request disposition notification.
-h             : displays this help.
-q             : supresses *all* output.
-debug         : Echoes server communications to screen (disables '-q' ).
-noh           : prevent X-Mailer header from showing homepage of blat
-noh2          : prevent X-Mailer header entirely
-p <profile>   : send with SMTP server, user and port defined in <profile>.
-server <addr> : Specify SMTP server to be used. (optionally, addr:port)
-port <port>   : port to be used on the server, defaults to SMTP (25)
-hostname <hst>: select the hostname used to send the message
-mime          : MIME Quoted-Printable Content-Transfer-Encoding.
-uuencode      : Send (binary) file UUEncoded
-base64        : Send (binary) file using base64 (binary Mime)
-try <n times> : how many time blat should try to send. from '1' to 'INFINITE'
-attach <file> : attach binary file to message (may be repeated)
-attacht <file>: attach text file to message (may be repeated)
-ti <n>        : Set timeout to 'n' seconds.

Note that if the '-i' option is used, <sender> is included in 'Reply-to:'
and 'Sender:' fields in the header of the message.

---------------------------------------------------------------------
ungetestet:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
sub send_to_blat {

 # Benötigte Variablen lokal zur Verfügung stellen              
;            #
      local($print_config,$key,$sort_order,$sorted_field,$env_report);

 # Email Subject bestimmen
   $betreff = '';
      if ($Config{'subject'}) { $betreff = $Config{'subject'} }
      else               
     { $betreff = WWW Form Submission }

 # Adresse bestimmen
  $address = $Config{'recipient'};

 # Messageinhalt bestimmen
  # Variable initialisieren, hier soll der komplette Textkörper hineingeschrieben werden
  $message = 'Anbei die Resultate der Befragung. Sie wurden abgeschickt durch:
' . '$Config{'realname'} ($Config{'email'}) on $date
';

  # Prüft die Option print_config und handelt entsprechend
  if (@Print_Config) {
     foreach $print_config (@Print_Config) {
          if ($Config{$print_config}) {
          $message .= '$print_config: $Config{$print_config}

';
       }
     }
  }

  # Alphabetisch sortieren, falls verlangt             &nbs
p;               #
     if ($Config{'sort'} eq 'alphabetic') {
           foreach $field (sort keys %Form) {

            # If the field has a value or the print blank fields option      #
            # is turned on, print out the form field and value.              
#
            if ($Config{'print_blank_fields'} || $Form{$field} ||
               
 $Form{$field} eq '0') {
               
 $message .= '$field: $Form{$field}

';
            }
         }
     }

     # Felder nach angegebener Reihenfolge sortieren, falls verlangt      #
  elsif ($Config{'sort'} =~ /^order:.*,.*/) {

           # Remove extraneous line breaks and spaces, remove the order:  #
     # directive and split the sort fields into an array.           #
           $Config{'sort'} =~ s/(\s+|
)?,(\s+|
)?/,/g;
           $Config{'sort'} =~ s/(\s+)?
+(\s+)?//g;
           $Config{'sort'} =~ s/order://;
           @sorted_fields = split(/,/, $Config{'sort'});

           # For each sorted field, if it has a value or the print blank  #
           # fields option is turned on print the form field and value.   #
           foreach $sorted_field (@sorted_fields) {
               
   if ($Config{'print_blank_fields'} || $Form{$sorted_field} || $Form{$sorted_field} eq '0') {
               
    $message .= '$sorted_field: $Form{$sorted_field}

';
               
 }
           }
       }

       # Ansonsten in der angegeben Reihenfolge verschicken      #
       else {

        # For each form field, if it has a value or the print blank          #
        # fields option is turned on print the form field and value.         #
        foreach $field (@Field_Order) {
            if ($Config{'print_blank_fields'} || $Form{$field} || $Form{$field} eq '0') {
               
 $message .= '$field: $Form{$field}

';
            }
        }
    }

    # System Umgebungsvariablen mit in die Nachricht einpacken             &nb
sp;   #
      foreach $env_report (@Env_Report) {
        if ($ENV{$env_report}) {
            $message .= '$env_report: $ENV{$env_report}
';
        }
      }


 # Zusammenstellen der Kommandozeile für späteren Systemaufruf
   $commandline = $mailprog;
   $commandline .= $message;
   $commandline .= "-s \"$betreff\" " if $betreff;
   $commandline .= "-t \"$recipients\" " if $recipients;
   # $commandline .= "-f $config{'email'} " if $config{'email'};

    # Senden der Email
   system($commandline);
\n\n

<!--EDIT|renee|1062144858-->
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Sendmail für Windows