Sending Automated Mail Without Local Admin Rights On Windows Machine Using Outlook

Hi everyone , Wondering how to send a mail  from your windows machine using Outlook .Well if Outlook is there it becomes very simple to trigger a mail using script. In fact Outlook takes care of SMTP and other configurations.

Here I am going to tell how can you send an automated mail  without local admin rights on windows machine  by writing a small script . And the best part is you do not required port 25 to open or other adminstrative tools . Not even some SMTP servers .

It is the best example if you  This kind of script is very helpful for sending mail through desktop windows  applications . It can easily be run by  just double click on the script or  by invoking it by other means like by JAVA , C++ ,C# or by some other languages.

So here we go ,There are 2 steps .

1> You should have  Microsoft mail app  Outlook on your windows  machine , If not no need to worry , while executing the Script on your windows  machine ,it will ask for download  just download Microsoft Mail App that is Outlook on your windows  machine and login into Outlook  through your gmail or what ever Id. If you are working in any organisation where you don’t have local admin rights then you may definitely have Outlook Installed on your windows  machine.

2 >Open a notepad  paste and the below code and save as test.vbs on desktop.  Just double click and  your mail is sent. The Outlook must be opened.

Set TestMail = CreateObject(“Outlook.Application”)
Set MailItem = TestMail.CreateItem(0)
With MailItem
.To = “XXX@gmail.com”
.Subject = “Create a mail sending script in note pad

.AddAttachment  = //Path of attachment
.aEnd With
MailItem.Send

If you want this mail script to be triggered  by some java application so here is the Java code.Just create  create a class , compile and run on the same windows machine .

import java.io.IOException;

public class MailTest {
public static void main(String[] args) {
try {
Runtime.getRuntime().exec( “wscript C://Users//Desktop//test.vbs” );
}
catch( IOException e ) {
System.out.println(e);
System.exit(0);
}
}
}

One more thing the sender of this mail is going to be the current logged in user of your Outlook.

If you want to send bulk mail using Outlook and  vbs  then click here , how to send a bulk mail using Outlook and vbs script.

Cheers ,

Enjoy Mailing using Outlook and  vbs.

 

 

 

 

 

Leave a Reply