Schrift
[thread]18[/thread]

Sendmail für Windows (Seite 2)



<< |< 1 2 >| >> 19 Einträge, 2 Seiten
Drain
 2003-08-28 13:07
#1219 #1219
User since
2003-08-21
26 Artikel
BenutzerIn
[default_avatar]
Es bleibt einem also nichts anderes übrig, als den Emailversand für beide Varianten anzupassen. Na gut, mache ich es so.

Danke an alle für Eure Hilfe.

Drain
Drain
 2003-08-28 14:08
#1220 #1220
User since
2003-08-21
26 Artikel
BenutzerIn
[default_avatar]
Kann mir jemand noch ein Beispiel geben, wie man die Übergabewerte an blat gibt?

Mit sendmail siehts ja so aus:
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
# for UNIX-Systems
        my $Mail_Prog = 'sendmail.exe';
        open (MAIL, "|$Mail_Prog -t") || die "Mailprogramm konnte nicht gestartet werden
";
        print MAIL "To: xxx\@yyy.de
";
        print MAIL "From: $Formular{Name} <$Formular{Email}>
";
        print MAIL "Subject: Formular Homepage

";
        # Textbereich Email
        if( $Formular{Formular} eq "Infomaterial") {
                # special format for formular "Infomaterial"
                print MAIL "\[Titel Name\]
$Formular{Titel} $Formular{Name}

";
                print MAIL "\[Firma\]
$Formular{Firma}

";
                print MAIL "\[Adresse\]
$Formular
...
        close(MAIL);

Und bei blat? Werde da aus der Doku nicht ganz schlau.\n\n

<!--EDIT|Drain|1062065345-->
Drain
 2003-08-29 11:01
#1221 #1221
User since
2003-08-21
26 Artikel
BenutzerIn
[default_avatar]
Jetzt sieht wohl niemand mehr in dieses Posting, weil ich zweimal hintereinander gepostet habe. Hoffe dennoch auf Antwort.

Drain
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/
Drain
 2003-08-29 13:40
#1223 #1223
User since
2003-08-21
26 Artikel
BenutzerIn
[default_avatar]
OK, danke. Es funktioniert. Das mit dem system-Befehl ist mir neu.
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
sub Blat {
        my $Mail_Prog = 'blat.exe';
        my $commandline = $Mail_Prog;
        $commandline .= " -";                                                                                   # attach no file
        $commandline .= " -to xxx\@yyy.de";                                             # To
        $commandline .= " -f \"$Formular{Name} $Formular{Email}\"";     # From
        $commandline .= " -s \"Formular Homepage (Blat)\"";                             # Subject
        $commandline .= " -body \"";                                                                    # Body
        $commandline .= &MailBody;                                                                              # Body
        $commandline .= "\"";                                                                                  # Body
        $commandline .= " -log blatlog.txt";                                                    # Create Logfile for testing
        # Senden der Email
        system($commandline);


Jetzt habe ich noch ein kleines Problem. In dem Unterprogramm &MailBody wird der Email-Inhalt zusammengestellt. Darin ist unter anderem die im Formular eingegebene Email-Adresse. Jetzt macht mir aber in meiner Vorgehensweise das @-Zeichen Probleme. Müßte davor manuell ein "\" setzen, sonst klappt der Aufruf von blat nicht. Wie ersetzt man in einem Skalar einen Zeichenausdruck? Muß ich das dann für alle Sonderzeichen machen? Oder gibt es da eine bessere Variante zur Lösung dieses Problems?

Drain\n\n

<!--EDIT|Drain|1062150751-->
Drain
 2003-08-29 14:11
#1224 #1224
User since
2003-08-21
26 Artikel
BenutzerIn
[default_avatar]
Oh, lag nicht an dem "@", sondern hab in &MailBody als letztes Zeichen ein "\n" ausgegeben. Dadurch kam der blat-Aufruf durcheinander.
Jetzt scheints zu klappen.
GwenDragon
 2006-07-19 19:30
#1225 #1225
User since
2005-01-17
14848 Artikel
Admin1
[Homepage]
user image
docsnyder
 2006-08-01 15:04
#1226 #1226
User since
2005-09-08
300 Artikel
BenutzerIn
[Homepage] [default_avatar]
Warum nicht einfach bei Perl bleiben: MIME::Lite ?

Läuft überall wo Perl läuft und benötigt kein sendmail ;o)

Gruß, Doc
GwenDragon
 2006-08-01 16:53
#1227 #1227
User since
2005-01-17
14848 Artikel
Admin1
[Homepage]
user image
[quote=docsnyder,01.08.2006, 13:04]Warum nicht einfach bei Perl bleiben: MIME::Lite ?

Läuft überall wo Perl läuft und benötigt kein sendmail ;o)[/quote]
Stimmt bedingt.

Ich ändere doch nicht in allen Skripten wo an /usr/lib/sendmail gepipet wird, alles ab udn patche MIME::Lite hinzu. Nee.
<< |< 1 2 >| >> 19 Einträge, 2 Seiten



View all threads created 2003-08-22 15:57.