Send Email from Script

393 views
Skip to first unread message

Ltester

unread,
Aug 13, 2010, 3:34:06 PM8/13/10
to LoadRunner


I am trying to know if sending an email from loadrunner script is
possible, so lets say we have 4 transactions
i want to get an email after the user finishes the 2nd transaction, is
that possible? if yes, it would be great if you can mention how to go
about adding this

Krishnakanth PPS

unread,
Aug 13, 2010, 3:36:08 PM8/13/10
to lr-loa...@googlegroups.com
from outlook???

if yes i think its possible


--
You received this message because you are subscribed to the Google "LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en

James Pulley

unread,
Aug 14, 2010, 3:40:34 PM8/14/10
to lr-loa...@googlegroups.com
Add Winsock to your script type and then use the SMTP standard to generate a
message and send it through a local SMTP relay. Or, build a DLL which can
send an SMTP message for you, then lr_load_dll() with the exposed function,
call this function from your LoadRunner virtual users. On the latter
option you will need to make sure your DLL code is thread safe

James Pulley, http://www.loadrunnerbythehour.com

--

Krishnakanth PPS

unread,
Aug 14, 2010, 4:01:23 PM8/14/10
to lr-loa...@googlegroups.com
does he really need winsock.

Just put a system command which wud trigger a command line email which would use a SMTP tool like the one below. 


should it not be that simple. havent tried. but dont u think it shud work.. wud update once i try.

John Crunk

unread,
Aug 13, 2010, 4:00:29 PM8/13/10
to lr-loa...@googlegroups.com
It is possible. You will just have to code it. Depends on the protocol as to the code itself

Sent from my iPhone

James Pulley

unread,
Aug 14, 2010, 8:59:19 PM8/14/10
to lr-loa...@googlegroups.com

When in doubt I always run to the standards, or in this case the RFCs for SMTP.   If a command line version exists which can be exercised via a system() call, then all the better!

Vamsi

unread,
Aug 16, 2010, 1:10:51 PM8/16/10
to LoadRunner
I had written a sample code to send emails using Loadrunner and blat
in the following link.

http://performancetestinginfo.blogspot.com/2010/03/sending-emails-using-blat-utility-in.html

Regards
Vamsi


On Aug 15, 5:59 am, "James Pulley" <loadrunner-li...@jamespulley.com>
wrote:
> When in doubt I always run to the standards, or in this case the RFCs for
> SMTP.   If a command line version exists which can be exercised via a
> system() call, then all the better!
>
> From: lr-loa...@googlegroups.com [mailto:lr-loa...@googlegroups.com]
> On Behalf Of Krishnakanth PPS
> Sent: Saturday, August 14, 2010 4:01 PM
> To: lr-loa...@googlegroups.com
> Subject: Re: Send Email from Script
>
> does he really need winsock.
>
> Just put a system command which wud trigger a command line email which would
> use a SMTP tool like the one below.
>
> http://www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm
>
> should it not be that simple. havent tried. but dont u think it shud work..
> wud update once i try.
>
> On Sun, Aug 15, 2010 at 1:10 AM, James Pulley
>
> <loadrunner-li...@jamespulley.com> wrote:
>
> Add Winsock to your script type and then use the SMTP standard to generate a
> message and send itthrough
>
> through a local SMTP relay.   Or, build a DLL which can
> send an SMTP message for you, then lr_load_dll() with the exposed function,
> call this function from your LoadRunner virtual users.   On the latter
> option you will need to make sure your DLL code is thread safe
>
> James Pulley,http://www.loadrunnerbythehour.com
>
>
>
> -----Original Message-----
> From: lr-loa...@googlegroups.com [mailto:lr-loa...@googlegroups.com]
>
> On Behalf Of Ltester
> Sent: Friday, August 13, 2010 3:34 PM
> To: LoadRunner
> Subject: Send Email from Script
>
> I am trying to know if sending an email from loadrunner script is
> possible, so lets say we have 4 transactions
> i want to get an email after the user finishes the 2nd transaction, is
> that possible? if yes, it would be great if you can mention how to go
> about adding this
>
> --
> You received this message because you are subscribed to the Google
> "LoadRunner" group.
> To post to this group, send email to LR-Loa...@googlegroups.com
> To unsubscribe from this group, send email to
> LR-LoadRunne...@googlegroups.com
> <mailto:LR-LoadRunner%2Bunsu...@googlegroups.com>
> For more options, visit this group athttp://groups.google.com/group/LR-LoadRunner?hl=en
>
> --
> You received this message because you are subscribed to the Google
> "LoadRunner" group.
> To post to this group, send email to LR-Loa...@googlegroups.com
> To unsubscribe from this group, send email to
> LR-LoadRunne...@googlegroups.com
> <mailto:LR-LoadRunner%2Bunsu...@googlegroups.com>
> For more options, visit this group athttp://groups.google.com/group/LR-LoadRunner?hl=en

Richard Bishop

unread,
Aug 18, 2010, 10:08:36 AM8/18/10
to LoadRunner
I've written an article about this on my site....
I managed to get the code down to three lines in a LoadRunner script
using BLAT.....

http://www.bish.co.uk/index.php?option=com_content&view=article&id=107:using-loadrunner-to-send-an-email&catid=34:recent&Itemid=1

Sample code -
char cCommand[1024]; // char variable to hold the contents of DOS
commands
sprintf(cCommand, "c:\\blat\\blat.exe c:\\blat\\Test.txt -subject
\"Test Complete\" -to na...@mail.com -server mailserver.domain.com -f
user...@mailserver.domain.com -iu username -ipw password");
system(cCommand);


Good luck
Richard

On 13 Aug, 20:34, Ltester <azarco...@gmail.com> wrote:
> I am trying to know if sending anemailfrom loadrunner script is
> possible, so lets say we have 4 transactions
> i want to get anemailafter the user finishes the 2nd transaction, is

Richard Bishop

unread,
Aug 18, 2010, 6:00:24 AM8/18/10
to LoadRunner
I've used BLAT in the past and I wrote a quick article on my site
explaining how to do this using a LoadRunner system command.
I tested it this morning and I've uploaded the BLAT code and a sample
script.

http://www.bish.co.uk/index.php?option=com_content&view=article&id=107:using-loadrunner-to-send-an-email&catid=34:recent&Itemid=1

Because BLAT sends an email based on the contents of the file, you
could use another script to write the contents of the file for you as
well.

These three lines are all you need in your LoadRunner script......

char cCommand[1024]; // char variable to hold the contents of DOS
commands
sprintf(cCommand, "c:\\blat\\blat.exe c:\\blat\\Test.txt -subject
\"Test Complete\" -to na...@mail.com -server mailserver.domain.com -f
user...@mailserver.domain.com -iu username -ipw password");
system(cCommand);


Good luck
Richard



On Aug 16, 6:10 pm, Vamsi <vamsi...@gmail.com> wrote:
> I had written a sample code to send emails using Loadrunner and blat
> in the following link.
>
> http://performancetestinginfo.blogspot.com/2010/03/sending-emails-usi...
>
> Regards
> Vamsi
>
> On Aug 15, 5:59 am, "James Pulley" <loadrunner-li...@jamespulley.com>
> wrote:
>
>
>
> > When in doubt I always run to the standards, or in this case the RFCs for
> > SMTP.   If a command line version exists which can be exercised via a
> > system() call, then all the better!
>
> > From: lr-loa...@googlegroups.com [mailto:lr-loa...@googlegroups.com]
> > On Behalf Of Krishnakanth PPS
> > Sent: Saturday, August 14, 2010 4:01 PM
> > To: lr-loa...@googlegroups.com
> > Subject: Re: SendEmailfrom Script
>
> > does he really need winsock.
>
> > Just put a system command which wud trigger a command lineemailwhich would
> > use a SMTP tool like the one below.
>
> >http://www.beyondlogic.org/solutions/cmdlinemail/cmdlinemail.htm
>
> > should it not be that simple. havent tried. but dont u think it shud work..
> > wud update once i try.
>
> > On Sun, Aug 15, 2010 at 1:10 AM, James Pulley
>
> > <loadrunner-li...@jamespulley.com> wrote:
>
> > Add Winsock to your script type and then use the SMTP standard to generate a
> > message and send itthrough
>
> > through a local SMTP relay.   Or, build a DLL which can
> > send an SMTP message for you, then lr_load_dll() with the exposed function,
> > call this function from your LoadRunner virtual users.   On the latter
> > option you will need to make sure your DLL code is thread safe
>
> > James Pulley,http://www.loadrunnerbythehour.com
>
> > -----Original Message-----
> > From: lr-loa...@googlegroups.com [mailto:lr-loa...@googlegroups.com]
>
> > On Behalf Of Ltester
> > Sent: Friday, August 13, 2010 3:34 PM
> > To: LoadRunner
> > Subject: SendEmailfrom Script
>
> > I am trying to know if sending anemailfrom loadrunner script is
> > possible, so lets say we have 4 transactions
> > i want to get anemailafter the user finishes the 2nd transaction, is
> > that possible? if yes, it would be great if you can mention how to go
> > about adding this
>
> > --
> > You received this message because you are subscribed to the Google
> > "LoadRunner" group.
> > To post to this group, sendemailto LR-Loa...@googlegroups.com
> > To unsubscribe from this group, sendemailto
> > LR-LoadRunne...@googlegroups.com
> > <mailto:LR-LoadRunner%2Bunsu...@googlegroups.com>
> > For more options, visit this group athttp://groups.google.com/group/LR-LoadRunner?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > "LoadRunner" group.
> > To post to this group, sendemailto LR-Loa...@googlegroups.com
> > To unsubscribe from this group, sendemailto
> > LR-LoadRunne...@googlegroups.com
> > <mailto:LR-LoadRunner%2Bunsu...@googlegroups.com>
> > For more options, visit this group athttp://groups.google.com/group/LR-LoadRunner?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > "LoadRunner" group.
> > To post to this group, sendemailto LR-Loa...@googlegroups.com
> > To unsubscribe from this group, sendemailto
Reply all
Reply to author
Forward
0 new messages