Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: how to send an email via Stata Command


From   Lance Erickson <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: how to send an email via Stata Command
Date   Mon, 28 Jan 2013 21:35:07 +0000

I've been sending emails from Stata after each class period to keep students updated on their record from a classroom response system that I use to track student attendance and award points for quiz questions done in class. I've used a command line utility as Jeph suggested, but the one I use is CSSmtp (there was a trial period and then I think I ended up paying something like $20 for it) though I imagine any would work fine. 

I have a data set with student contact information and merge the data from the classroom response system, calculate some summary information, and then loop through each student and send them a personalized email. Here's the code I use to loop through the students, create the files that are the content of the email, and send the emails. I'm sure text wrapping will make it hard to read. Note that I hid the server address that I actually use.

Lance
_____

forvalues i = 1/`=_N' {

	capture file close clicker
	file open clicker using "iClicker email\\`=last[`i']' `=first[`i']' `=c(current_date)'.txt", write replace

	file write clicker "`=first[`i']'," _n _n
	file write clicker "As of `=c(current_date)', the following represents the record I have for your attendance and iClicker points." _n _n
	file write clicker "               Classes missed:   `=missed[`i']'" _n _n
	file write clicker "               unweighted iClicker points:    `=aggregateperformance[`i']'/`=max_i[`i']'" _n
	file write clicker "               weighted iClicker points:        `=weighted[`i']'/50" _n _n
	file write clicker "Remember that you can only miss 8 classes before you lose the 50 attendance points. The weighted score is what your overall score would be for the class if this were the final tally. In other words, if it was time to submit grades, the weighted total would be the points that would count toward your grade. Check the syllabus for a reminder of the attendance and clicker policies. Then let me know if you have any questions." _n _n
	file write clicker "Lance"

	file close clicker
		
	!"C:\Users\lde\Documents\DATA\CSSmtp" "iClicker email\`last' `first' `=c(current_date)'.txt" ///
		-hserver.university.edu ///
		[email protected] ///
		-r`=email[`i']' ///
		-s"Soc 111 Attendance and iClicker points for `=c(current_date)'" ///
		-f"iClicker email\\`=last[`i']' `=first[`i']' `=c(current_date)'.txt"
}

_____________




-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Monday, January 28, 2013 1:17 AM
To: [email protected]
Subject: st: how to send an email via Stata Command

I use the following command with Win XP and MS Office 2007:

winexec "C:\Programme\Microsoft Office\Office12\OUTLOOK.EXE"  /a "d:\temp.txt" /c ipm.note.whatevername  

I'm not sure if it works with Outlook Express.

Adjust the path to your Outlook Express .EXE.
/a specifies the path to your attachment.
/c specifies that an pre-specified email is send 

To specifiy "ipm.note.whatevername" in Outlook 2007 you open an empty mail and write it. Then save it using "Extras" -> "Forms" -> "Publish Form"
( I don't use the English version so I don't know the correct english menu titles.)

(Or you could use " /m [email protected]&subject=subject%20without%20spaces " to only provide address and subject)

This creates and shows the mail but doesn't send it. That's alright with me because I want to check every mail before sending. 
In Outlook you can specify automatic sending for your "ipm.note.whatevername" form.
Difficult to explain for me here. You have to open the form in the form editor and add an "item.send" to the "Item_open" function.
You'll find detailed howtos on the web.

Best wishes

Stefan Gawrich
Dillenburg
Germany











*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index