EnglishРусский  

   ..

   smtp.g

   smtpdemo.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\lib\smtp\smtpdemo.g
 1 /******************************************************************************
 2 *
 3 * Copyright (C) 2009, The Gentee Group. All rights reserved. 
 4 * This file is part of the Gentee open source project - http://www.gentee.com. 
 5 * 
 6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
 7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
 8 * ACCEPTANCE OF THE AGREEMENT.
 9 *
10 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13 
14 include : "smtp.g"
15 
16 func uint smtpnotify( uint code, inetnotify ni )
17 {
18    switch code
19    {
20       case $NFYINET_ERROR
21       {
22          print("Error [\(code)]: \(ni.head)\l")
23       }
24       case $NFYINET_CONNECT : print("Connecting \(ni.url)...\n")
25       case $NFYSMTP_SENDCMD : print("TO: \(ni.head)\n")
26       case $NFYSMTP_RESPONSE : print("FROM: \(ni.head)\n")
27 /*      default
28       {
29          print("NFY \(code ): \(ni.url) H=\(ni.head) \( ni.param) \(ni.sparam)\l")
30       }*/
31    }
32    return 1
33 }
34 
35 func smtptest<main>
36 {
37    smtp test
38    
39    inet_init()
40    test.open( "mail.domain.com", 25, "my@domain.com", "password", &smtpnotify )
41    test.send( "John Smith <my@domain.com>",
42        "john@domain.com, John Smith JR <jr@domain.com>", "Subject", 
43               "Body of the email message", "" )
44    test.close()
45    inet_close()
46    congetch("Press any key...")
47 }
48