cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vizzie
Visitor
Visitor
11,082 Views
Registered: ‎10-02-2008

ModelSim XE script: sending email after simulation has finished

Jump to solution

Hello,

I have a big simulation program that takes a while to finish. I have to periodically check it to find out if the script for automated simulation is still running. Is there a way I can include something in my tcl (.do) script (for automating simulations in ModelSim XE) so that it sends me an email every time it finishes executing the entire script?

Thanks.

Regards,

 

Vijay.

0 Kudos
1 Solution

Accepted Solutions
vizzie
Visitor
Visitor
13,146 Views
Registered: ‎10-02-2008

Hello,

 

I realized that the script that I posted before may not work on some networks as it doesn't have the originator labeled on it. The complete script then would be as follows:

 

proc send_simulation_complete_mail {from to email_server subject body} {
package require smtp
package require mime

set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -originator $from -recipients $to -servers $email_server
mime::finalize $token
}

send_simulation_complete_mail fromemail@frommailplace toemail@tomailplace name_of_email_server "Subject: Your simulation is complete." "Body: It was boring, monotonous, sedate, tedious, soporific,..."

 

 

Regards,

 

Kumar Vijay Mishra.

View solution in original post

5 Replies
eilert
Teacher
Teacher
11,071 Views
Registered: ‎08-14-2007

Hi Vijay,

there's a email package for Tcl:

 

http://web.uvic.ca/~erempel/tcl/Email/Email.html

 

Just found it using google with these searchwords: tcl email

So I have no experience with it.

 

Please give some feedback on how it worked, or whatever solution you found for this problem. 

 

Have a nice simulation

  Eilert

vizzie
Visitor
Visitor
11,045 Views
Registered: ‎10-02-2008

Thanks eilert for your reply.

 

Turns out this was a simpler task as far as Tcl/Tk is concerned.But I was a tad worried if all the packages are available with Modelsim XE or not. However, the Tcl/Tk solution worked for the ModelSim scripts also.

 

What I did is added the following after the last line of my simulation script:

 

 

proc send_simulation_complete_mail {recipient email_server subject body} { package require smtp package require mime set token [mime::initialize -canonical text/plain -string $body] mime::setheader $token Subject $subject smtp::sendmessage $token -recipients $recipient -servers $email_server mime::finalize $token } send_simulation_complete_mail myemail@mymailplace.mydomain name_of_my_local_smtp_host "Subject: Your simulation is complete." "Body: It was boring, monotonous, tedious, soporific,...but Good God! I am done."

 

I am using 32-bit Windows OS for ModelSim XE simulations where I have set my default email client as Thunderbird. So, the above proc operates through Thunderbird. Other email client users (EVolution, Outlook, Macmail etc) should evaluate this code for their email clients. I am pretty sure it would work there as well.

 

I also found some other useful Tcl scripts which worked with ModelSim  regardinggenerating email (not sending it) and more detailed sendmail ecripts (with attachments etc).Please see here and here.

 

Regards,

 

Kumar Vijay Mishra.

 

Tags (4)
0 Kudos
vizzie
Visitor
Visitor
13,147 Views
Registered: ‎10-02-2008

Hello,

 

I realized that the script that I posted before may not work on some networks as it doesn't have the originator labeled on it. The complete script then would be as follows:

 

proc send_simulation_complete_mail {from to email_server subject body} {
package require smtp
package require mime

set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -originator $from -recipients $to -servers $email_server
mime::finalize $token
}

send_simulation_complete_mail fromemail@frommailplace toemail@tomailplace name_of_email_server "Subject: Your simulation is complete." "Body: It was boring, monotonous, sedate, tedious, soporific,..."

 

 

Regards,

 

Kumar Vijay Mishra.

View solution in original post

pradeep_kumar
Newbie
Newbie
8,220 Views
Registered: ‎11-08-2013

Hi

     I am getting an error "Could'nt open socket: Invalid argument". Please help me. It is helpfull if example server name is provided.

0 Kudos
roymesi2
Adventurer
Adventurer
6,360 Views
Registered: ‎07-17-2012

I also tried this now, and getting the same error:

"couldn't open socket: invalid argument"

 

Furthermore, what should I put instead of:

fromemail@frommailplace toemail@tomailplace name_of_email_server

why 2 emails are needed?

name of email server is just outlook (if I'm using outlook)?

Thx.

0 Kudos