Jump to content

Recommended Posts

Posted (edited)

I recommended you to use Jos version as this version requires another assembly(.NET 3.5)

Use can use stream write to write to the program

Local $foo = Run("AutoMail.exe", @ScriptDir, @SW_HIDE, $STDIN_CHILD)
StdinWrite($foo, "WRITE YOU DATA HERE" & @CRLF)

Writing list, must be in the same order!

These are not default. They are just examples.

Host name, smtp.gmail.com

Port, 587

SSL?, True or false only

You Email, myemail@gmail.com

You Name, My Name(Display name)

Receiver Email, toAddress@anything.com

Receiver Name, Johny

Your password, [secret]

You subject

Now you body begins write anything you want.

To stop write :::END::: on a new line.

That's it.

Example

Local $foo = Run("AutoMail.exe", @ScriptDir, @SW_HIDE, $STDIN_CHILD)
StdinWrite($foo, "smtp.gmail.com" & @CRLF)
StdinWrite($foo, "587" & @CRLF)
StdinWrite($foo, "true" & @CRLF)
StdinWrite($foo, "myemail@gmail.com" & @CRLF)
StdinWrite($foo, "My name" & @CRLF)
StdinWrite($foo, "toEmail@test.com" & @CRLF)
StdinWrite($foo, "To Name" & @CRLF)
StdinWrite($foo, "myPassword" & @CRLF)
StdinWrite($foo, "My Test Subject" & @CRLF)
StdinWrite($foo, "Hello," & @CRLF)
StdinWrite($foo, "How are you doing" & @CRLF)
StdinWrite($foo, "I am good and you?" & @CRLF)
StdinWrite($foo, "Haha" & @CRLF)
StdinWrite($foo, ":::END:::" & @CRLF)

As it contains/needs password so I am going to release the source.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Net.Mail;

using System.Text;

namespace AutoMail

{

class Program

{

static void Main(string[] args)

{

var host = Console.ReadLine();

int port; Int32.TryParse(Console.ReadLine(), out port);

bool isSsl; Boolean.TryParse(Console.ReadLine(), out isSsl);

var fromEmail = Console.ReadLine();

if (fromEmail == null) return;

var fromAddress = new MailAddress(fromEmail, Console.ReadLine());

var toEmail = Console.ReadLine();

if (toEmail == null) return;

var toAddress = new MailAddress(toEmail, Console.ReadLine());

string fromPassword = Console.ReadLine();

string subject = Console.ReadLine();

var body = new StringBuilder();

var tempBody = Console.ReadLine();

do

{

if (tempBody != ":::END:::")

{

body.Append(tempBody);

}

tempBody = Console.ReadLine();

} while (tempBody != ":::END:::");

var smtp = new SmtpClient

{

Host = host,

Port = port,

EnableSsl = isSsl,

DeliveryMethod = SmtpDeliveryMethod.Network,

UseDefaultCredentials = false,

Credentials = new NetworkCredential(fromAddress.Address, fromPassword)

};

using (var message = new MailMessage(fromAddress, toAddress)

{

Subject = subject,

Body = body.ToString()

})

{

smtp.Send(message);

}

}

}

}

AutoMail.exe

Edited by athiwatc

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...