Created
June 1, 2012 16:15
-
-
Save swarbhanu/2853282 to your computer and use it in GitHub Desktop.
Script to send an actual email through the user notification service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from interface.objects import DeliveryMode, UserInfo, DetectionFilterConfig | |
from pyon.event.event import EventPublisher | |
#--------------------------------------------------------------------------------- | |
# Create email notification | |
#--------------------------------------------------------------------------------- | |
rr = pn.resource_registry | |
user = UserInfo(name = 'user') | |
user_id, _ = rr.create(user) | |
uns = pn.user_notification | |
notification_id = uns.create_email(event_type='ResourceLifecycleEvent', | |
event_subtype=None, | |
origin='Some_Resource_Agent_ID1', | |
origin_type=None, | |
user_id=user_id, | |
email='[email protected]', | |
mode = DeliveryMode.DIGEST, | |
message_header='message_header', | |
parser='parser', | |
period=1) | |
#------------------------------------------------------- | |
# publish an event for each notification to generate the emails | |
#------------------------------------------------------- | |
rle_publisher = EventPublisher("ResourceLifecycleEvent") | |
rle_publisher.publish_event(origin='Some_Resource_Agent_ID1', description="RLE test event for email") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment