Sign in to follow this  
Followers 0
DCCD

Convert C# to AU3

4 posts in this topic

#1 ·  Posted (edited)

Name: Sending email using DNS server

MailMessage msg = new MailMessage();
    msg.From = "sender@mail.com";
    msg.To = "use1@mail.com;user2@mail.com";
    msg.Subject = "dns sending";
    msg.Body = "it is a test.";
    DnsMailClient client = new DnsMailClient();
    client.Send(msg);

thanks..

Edited by DCCD

Share this post


Link to post
Share on other sites



i need some help here? Convert C# to AU3

Name: Sending email using DNS server

MailMessage msg = new MailMessage();
    msg.From = "sender@mail.com";
    msg.To = "use1@mail.com;user2@mail.com";
    msg.Subject = "dns sending";
    msg.Body = "it is a test.";
    DnsMailClient client = new DnsMailClient();
    client.Send(msg);

thanks..

Read the help file dude, its really useful.

_INetMail is what you're looking for.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

it is :

$S_SMTPSERVER = "smtp.gmail.com"
$S_FROMNAME = "fo you"
$S_FROMADDRESS = "sender@mail.com"
$S_TOADDRESS = "use1@mail.com"
$S_SUBJECT = "it is a test."
$AS_BODY = "dns sending"
;$S_ATTACHFILES =  FileOpenDialog("", "", "", 1)
;MsgBox(0,"",$S_ATTACHFILES)
$S_CCADDRESS = "user2@mail.com"
$S_BCCADDRESS = ""
$S_USERNAME = "your name"
$S_PASSWORD = ""
$IPPORT =465;25;465
$SSL = 1


_INETSMTPMAILCOM($S_SMTPSERVER, $S_FROMNAME, $S_FROMADDRESS, $S_TOADDRESS, $S_SUBJECT, $AS_BODY, $S_ATTACHFILES, $S_CCADDRESS, $S_BCCADDRESS, $S_USERNAME, $S_PASSWORD, $IPPORT, $SSL)


Func _INETSMTPMAILCOM($S_SMTPSERVER, $S_FROMNAME, $S_FROMADDRESS, $S_TOADDRESS, $S_SUBJECT = "", $AS_BODY = "", $S_ATTACHFILES = "", $S_CCADDRESS = "", $S_BCCADDRESS = "", $S_USERNAME = "", $S_PASSWORD = "", $IPPORT = 25, $SSL = 0)
    $OBJEMAIL = ObjCreate("CDO.Message")
    $OBJEMAIL.From = '"' & $S_FROMNAME & '" <' & $S_FROMADDRESS & ">"
    $OBJEMAIL.To= $S_TOADDRESS
    Local $I_ERROR = 0
    Local $I_ERROR_DESCIPTION = ""
    If $S_CCADDRESS <> "" Then $OBJEMAIL.Cc = $S_CCADDRESS
    If $S_BCCADDRESS <> "" Then $OBJEMAIL.Bcc = $S_BCCADDRESS
    $OBJEMAIL.Subject = $S_SUBJECT
    If StringInStr($AS_BODY, "<") And StringInStr($AS_BODY, ">") Then
        $OBJEMAIL.HTMLBody = $AS_BODY
    Else
        $OBJEMAIL.Textbody = $AS_BODY & @CRLF
    EndIf
    If $S_ATTACHFILES <> "" Then
        Local $S_FILES2ATTACH = StringSplit($S_ATTACHFILES, ";")
        For $X = 1 To $S_FILES2ATTACH[0]
            $S_FILES2ATTACH[$X] = _PATHFULL($S_FILES2ATTACH[$X])
            If FileExists($S_FILES2ATTACH[$X]) Then
                $OBJEMAIL.AddAttachment($S_FILES2ATTACH[$X])
            Else
                $I_ERROR_DESCIPTION = $I_ERROR_DESCIPTION & @LF & "File not found to attach: " & $S_FILES2ATTACH[$X]
                SetError(1)
                Return 0
            EndIf
        Next
    EndIf
    $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $S_SMTPSERVER
    $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPORT
    If $S_USERNAME <> "" Then
        $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $S_USERNAME
        $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $S_PASSWORD
    EndIf
    If $SSL Then
        $OBJEMAIL.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    $OBJEMAIL.Configuration.Fields.Update
    $OBJEMAIL.Send
    If @error Then
        SetError(2)
        Return $OMYRET[1]
    EndIf
EndFunc
Edited by toxicvn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0