Most Basic EEM Script to Send E-mails
I have read through various blogs and Cisco posts and still cannot seem to get this to work. I am simply trying to get the router to send the "show ip int br" info via e-mail from a G-Mail account to a G-Mail account. I am wondering if this is unsupported because G-mail uses TLS/SSL and different ports and I can't seem to defined this anywhere. Can anyone confirm?
I manually run the EEM script via "event manager run IPAddressNotify". I have made sure that the router can ping "smtp.gmail.com" (IE IP reachability and name-lookups are successful).
event manager environment _email_to [email protected]
event manager environment _email_server gmailusername:[email protected]
event manager environment _email_from [email protected]
event manager applet IPAddressNotify
event none
action 1.0 info type routername
action 1.5 cli command "enable"
action 2.0 cli command "show ip int br"
action 8.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Router reload - IP Address info for $_info_routername" body "$_cli_result"
action 9.0 syslog msg "E-mail was sent"
Joseph,
Thanks for the info! This is perfect. Can you verify that my logic is clear, just so I know I am interpreting this correctly.
Right now, my IOS version does NOT support the "secure" and "port" parameters for EEM. Since G-Mail does NOT support unencrypted SMTP (verified), there is no way that I can use EEM or TCL to e-mail myself messages. Correct?
When you state that my username cannot have an '@' in it, is this referring to the 'from' field which would be "[email protected]"? Or, is this referring to the 'server' field which would be "gmailusername:[email protected]". Luckily, Google lets me authenticate by specifying 'gmailusername', rather than '[email protected]'. This should work then correct?
Similar Messages
-
Script to send a mail alert whenever server boot
hi,
I need a shell or perl script to send a mail alert to user whenever server boot, restart and shutdown.because in my office power problem is there.So the server restarted intermediatly.Kindly any one give a script to rectify my problem.If the server isat all important and you have a power problem, do consider getting a UPS. It might recover OK most times from power cuts (especially if you're on ZFS), but if you get other power problems like brown-outs and spikes, you might one day regret leaving it connected to a bad mains feed. Choose a mainstream brand like APC to be sure of Solaris support. The line-interactive versions, e.g. SmartUPS will recondition the mains waveform as well as maintaining supply during a power cut.
-
CSS11500 - check via script and sending e-mail
Hi together,
I want to check some parameters via script on the css.
That works fine.
Is there any possibillity to send an email with the result of this check script directly from the css ?
How do I have to configure the smtp server and the mailaddress.
thanks in advancethere is no sendmail functionality on the CSS.
SO, if you want to send emails, you will have to work at tcp level and create your onwn mail client.
Gilles. -
I had plans to configure a EEM script to send a email when an OSPF adjacency drops. I have an odd spanning-tree issue that I believe the drops are related to and I want to see if my suspicions are correct. This doesn't happen very often, and it's normaly late at night.
I originally planned something like this:
event manager environment _email_server 192.168.x.x
event manager environment _email_to [email protected]
event manager environment _email_from [email protected]
event manager session cli username "user"
event manager applet OSPF
event syslog pattern "%OSPF-"
action 1.0 cli command "enable"
action 1.1 cli command "show spanning-tree vlan 192"
action 1.2 cli command "show spanning-tree vlan 192 detail"
action 1.3 wait 10
action 1.4 cli command "show spanning-tree vlan 192"
action 1.5 cli command "show spanning-tree vlan 192 detail"
action 1.6 wait 20
action 1.7 cli command "show spanning-tree vlan 192"
action 1.8 cli command "show spanning-tree vlan 192 detail"
action 1.9 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Spanning-tree results" body "$_cli_result"
After trying this, it doesn't seem that NXOS support the email function.
My questions:
1. What alternative do I have? Is there a way to send the CLI output via SNMP or syslog?
2. Will this even run EVERY time the syslog pattern matches? Meaning if I get four %OSPF syslog messages, it will run four times repeatedly? \
Thank you,Hello Arie,
Thank you for answering my questions.
This is what I've got now. I think it will work well.
event manager applet OSPF
event syslog pattern "%OSPF-4-NEIGH_ERR"
action 1.0 cli command "enable"
action 1.1 cli command "show clock >> bootflash:ospf"
action 1.2 cli command "show spanning-tree vlan 192 >> bootflash:ospf"
action 1.3 cli command "show spanning-tree vlan 192 detail >> bootflash:ospf"
action 1.4 wait 10
action 1.5 cli command "show clock >> bootflash:ospf"
action 1.6 cli command "show spanning-tree vlan 192 >> bootflash:ospf"
action 1.7 cli command "show spanning-tree vlan 192 detail >> bootflash:ospf"
action 1.8 wait 10
action 1.9 cli command "show clock >> bootflash:ospf"
action 2.0 cli command "show spanning-tree vlan 192 >> bootflash:ospf"
action 2.1 cli command "show spanning-tree vlan 192 detail >> bootflash:ospf"
action 2.2 cli command "end"
action 2.3 cli command "exit"
--- Turns out "wait" isn't a option in NXOS either. I just put "show logging info" in its place, and didn't append it to the output file. That command takes about 10-15 seconds to run for some reason, so it should give me the pause I want. -
Given an url address how to send a mail?
Hi,
I would like to know the solution to this problem. Given the
address eg. [email protected] how to open or enter the mode similar
to reply button in hotmail.
thank you.
I did try this code. Doesn't work.
PROCEDURE kr_sendmail(
p_mail_subject IN VARCHAR2
,p_mail_to IN VARCHAR2
,p_mail_cc IN VARCHAR2 DEFAULT NULL
,p_mail_bcc IN VARCHAR2 DEFAULT NULL
,p_mail_body IN VARCHAR2 DEFAULT NULL
,p_attachment_source IN VARCHAR2 DEFAULT NULL
,p_attachment_name IN VARCHAR2 DEFAULT NULL
,p_display IN BOOLEAN DEFAULT TRUE
,p_cisoe_id IN NUMBER DEFAULT 0
,pio_entry_id IN OUT VARCHAR2)
IS
c_cisoe_id CONSTANT VARCHAR2
(30) := 'CISOEMAILID';
objArgL
OLE2.OBJ_TYPE;
objAppOutlook OLE2.OBJ_TYPE;
objNameSpace OLE2.OBJ_TYPE;
objInBox OLE2.OBJ_TYPE;
--objFolders OLE2.OBJ_TYPE;
--objFolder OLE2.OBJ_TYPE;
objMailItem OLE2.OBJ_TYPE;
objAttachments OLE2.OBJ_TYPE;
objAttachment OLE2.OBJ_TYPE;
objUserProperties OLE2.OBJ_TYPE;
objUserProperty OLE2.OBJ_TYPE;
v_id_new VARCHAR2(2000);
v_id_folder VARCHAR2(2000);
v_cisoe_id NUMBER;
v_test BOOLEAN;
BEGIN
-- Create Outlook Application Object
objAppOutlook := ole2.create_obj('Outlook.Application');
-- Get Namespace
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,'MAPI');
objNameSpace := ole2.invoke_obj
(objAppOutlook,'GetNamespace',objArgL);
ole2.destroy_arglist(objArgL);
-- Get InBox-Folder (Posteingang)
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,6);
objInBox := ole2.invoke_obj
(objNameSpace,'GetDefaultFolder',objArgL);
ole2.destroy_arglist(objArgL);
-- Create MailItem with properties
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,0);
objMailItem := ole2.invoke_obj
(objAppOutlook,'CreateItem',objArgL);
ole2.destroy_arglist(objArgL);
ole2.set_property(objMailItem,'To', p_mail_to);
ole2.set_property(objMailItem,'CC', p_mail_cc);
ole2.set_property(objMailItem,'BCC',p_mail_bcc);
ole2.set_property(objMailItem,'Subject',p_mail_subject);
ole2.set_property(objMailItem,'Body',p_mail_body);
--Test p_attachment_source
IF p_attachment_source IS NOT NULL THEN -- Create Attachment
--Test exist File
v_test := kr$fexists(p_attachment_source);
IF v_test = FALSE THEN --NOT TEXT_IO.IS_OPEN(v_test) THEN
--qms$errors.show_message(p_mesg=>'CKR-00022',p_param1 =>
1);
MESSAGE('Datei '||p_attachment_source||' ist nicht
existieren !');
RETURN;
ELSE
-- Create Attachment
objAttachments := ole2.get_obj_property
(objMailItem,'Attachments');
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,p_attachment_source);
ole2.add_arg(objArgL,1); --
property type
ole2.add_arg(objArgL,1); --
property position
ole2.add_arg(objArgL,p_attachment_name); -- property name
objAttachment := ole2.invoke_obj
(objAttachments,'Add',objArgL);
ole2.destroy_arglist(objArgL);
END IF;
END IF;
-- Create User Property
objUserProperties := ole2.get_obj_property
(objMailItem,'UserProperties');
objArgL := ole2.create_arglist;
ole2.add_arg(objArgL,c_cisoe_id); -- property name
ole2.add_arg(objArgL,3);
-- property type (number)
objUserProperty := ole2.invoke_obj
(objUserProperties,'Add',objArgL);
ole2.destroy_arglist(objArgL);
-- Set User Property
ole2.set_property(objUserProperty,'Value',p_cisoe_id);
-- Save
ole2.invoke(objMailItem,'Save');
-- Get Entry ID
v_id_new := ole2.get_char_property(objMailItem,'EntryID');
pio_entry_id := v_id_new;
-- Get User Property
v_cisoe_id := ole2.get_num_property(objUserProperty,'Value');
-- Create new Folder in InBox
-- objFolders := ole2.invoke_obj(objInBox,'Folders');
-- objArgL := ole2.create_arglist;
-- ole2.add_arg(objArgL,'MyFolder');
-- objFolder := ole2.invoke_obj(objFolders,'Add',objArgL);
-- ole2.destroy_arglist(objArgL);
-- Display Folder
-- ole2.invoke(objFolder,'Display');
-- Move Mail to new Folder
objArgL := ole2.create_arglist;
ole2.add_arg_obj(objArgL,objInbox); --objFolder);
ole2.invoke(objMailItem,'Move',objArgL);
ole2.destroy_arglist(objArgL);
v_id_folder := ole2.get_char_property(objMailItem,'EntryID');
-- Display or send
IF p_display
THEN
ole2.invoke(objMailItem,'Display');
ELSE
ole2.invoke(objMailItem,'Send');
END IF;
-- Release objects
ole2.release_obj(objUserProperty);
ole2.release_obj(objUserProperties);
--Test p_attachment_source
IF p_attachment_source IS NOT NULL THEN -- Create Attachment
ole2.release_obj(objAttachment);
ole2.release_obj(objAttachments);
END IF;
ole2.release_obj(objMailItem);
--ole2.release_obj(objFolder);
--ole2.release_obj(objFolders);
ole2.release_obj(objInBox);
ole2.release_obj(objNameSpace);
ole2.release_obj(objAppOutlook);
END kr_sendmail;An easier way is to use a perl-script for sending e-mail.
Using web.show_document, you can call this perl-script with
filled-parameters.
Call this perl-script in a blank window, let it close
automatically after the e-mail has been send.
Much less work, up to me...
(perl-script can be download for free at http://software.gyw.com)
Gr.,
.ob -
Issue with script timeouts - trying to send email mail shots - hosting recommendations?
Background is this - I look after a site for a recruitment agency, which has a backend mySQL database.
It includes a table of potential candidates, which the site owner can search based on various criteria and then send all the returned candidates an email about potential jobs they might be interested in.
I'm using an off the shelf script to send the emails, and have jumped through a few hoops to get this to work, but it looks like we need to move hosting unfortunately.
The script is able to limit emails so that the hosting company doesn't get black flagged as a spammer.
I've set it up with a progress bar in a new window so the site owner can see progress, but easily get back to the rest of the site.
But where we have come unstuck is the script timeout on the server - so even though its set to send emails slowly enough, ie under 500 emails an hour, because of that slow pace, it fails if it takes more then five minutes to send them all as the script times out.
My understanding is that the script includes a line to reset the script timeout value to 0, so enabling the script to keep running until all the emails have been sent. But unfortunately our current hosting company does not allow the script timeout to be reset at the PHP level.
So my question is this - is anyone doing anything similar, and if so, can you recommend any hosting company that does allow the script timeout to be reset at the PHP level?
Because at the minute it seems like a frustrating catch-22 - slow it down to get around the spam issue, and it won't run long enough to send all the emails. Speed it up, and it falls foul of the script timeout.
Any advise on this, or hosting suggestons most welcome!
Thanks.Although there is an AppleScript Forum, Automator can run AppleScripts, so sometimes things can go in either forum. In your script, other than not setting a recipient, you are just getting one of the persons. You need to get a list of your contact information, then build your outgoing messages from that list - for example:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
set theEmails to {} -- this will be a list of email addresses
set theNames to {} -- this will be a list of names for the greeting
tell application "Address Book"
activate
set theGroup to (choose from list (get the name of every group) with prompt "Choose a Group") as text
if theGroup is "false" then return -- cancel
repeat with aPerson in (get every person of group theGroup) -- build email and name lists
set the end of theEmails to the first item of (get the value of the email of aPerson) -- just the first address
set the end of theNames to the first name of aPerson
end repeat
end tell
tell application "Mail"
repeat with anItem from 1 to (count theEmails) -- make a new message for each entry
tell (make new outgoing message at the front of outgoing messages with properties {subject:"Test Mail"})
set visible to true
get item anItem of theNames
if the result is missing value then -- no name
set the content to "message"
else
set the content to "Dear " & the result & "," & return & return & "message"
end if
make new to recipient at the end of to recipients with properties {address:(item anItem of theEmails)}
end tell
end repeat
activate
end tell
</pre> -
Since 10.5 I can no longer script the sender if sending a mail via Mail
I would use the following script to send mail from different mail accounts using just the one account in 10.4.
set theBody to "abc"
set theSubject to "XYZ"
set theTarget to "[email protected]"
tell application "Mail"
set newMessage to make new outgoing message with
roperties {subject:theSubject, content:theBody}
tell newMessage
make new to recipient at end of to recipients with properties {address:theTarget}
*set sender to "[email protected]"*
end tell
send newMessage
end tell
*set sender to "[email protected]"* no longer works since upgrading to 10.5. It is ignored and the name of the account it is sends from is used in its place.
Does anybody know how to fix this in 10.5?
Message was edited by: ChangeAgentNo, I get my mail on my computer, not on a website. I used to be able to see the information but in sorting another issue I must have changed a setting or something. I have gone to View. Under Message Attributes most things are ticked but many of them are not bold print i.e. they are pale grey. I don't know how to activate them again.
-
How can scripts and smart forms send to mail and pdf?
HI i want to know how script and smartforms will send to mail and pdf formates>?
Dear Anees ,
Pleas pass on the parameter in itcpo - (getotf ) structure while calling OPEN_FORM as 'X' .
I have answered it in detail in your earlier post .
also giving below sample program for sending SAPSCRIPT as PDFattachment in email :
REPORT zsapscript_pdf_via_mail MESSAGE-ID zvele LINE-SIZE 68
NO STANDARD PAGE HEADING.
TABLES: itcpo.
Open your usual sapscript specifying that the output will be OTF
itcpo-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = 'PRINTER'
dialog = ''
form = '............'
language = sy-langu
options = itcpo
EXCEPTIONS
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
OTHERS = 6.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = '............'
element = '............'
EXCEPTIONS
window = 1
element = 2.
DATA: BEGIN OF t_otfdata OCCURS 0.
INCLUDE STRUCTURE itcoo.
DATA: END OF t_otfdata.
Closing the Sapscript, we save data (OTF) in a table
CALL FUNCTION 'CLOSE_FORM'
TABLES
otfdata = t_otfdata
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
OTHERS = 5.
DATA: len_in LIKE sood-objlen,
len_out LIKE sood-objlen.
DATA: BEGIN OF t_pdfdata OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA: END OF t_pdfdata.
DATA: BEGIN OF t_otfdata2 OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA: END OF t_otfdata2.
Move OTF data to another table with lenght 255
LOOP AT t_otfdata.
CONCATENATE t_otfdata-tdprintcom t_otfdata-tdprintpar INTO t_otfdata2.
APPEND t_otfdata2.
ENDLOOP.
Convert OTF format to PDF
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = 'OTF'
format_dst = 'PDF'
devtype = 'PRINTER'
FUNCPARA =
len_in = len_in
IMPORTING
len_out = len_out
TABLES
content_in = t_otfdata2
content_out = t_pdfdata
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
Download on local directory
*CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = len_out
FILENAME = 'c:\test.pdf'
FILETYPE = 'BIN'
TABLES
data_tab = t_pdfdata.
Mail settings
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINe.
DATA: doc_chng LIKE sodocchgi1.
DATA righe_attachment TYPE i.
DATA righe_testo TYPE i.
DATA z_email(80) TYPE c.
Receivers parameters
SELECT-OPTIONS: s_email FOR z_email LOWER CASE NO INTERVALS.
PARAMETERS rec_type LIKE reclist-rec_type
DEFAULT 'U'. " type of sending address
CLEAR: reclist, reclist[],
objhead, objhead[],
objtxt, objtxt[],
objbin, objbin[],
objpack, objpack[].
Attachment filling
LOOP AT t_pdfdata.
objbin-line = t_pdfdata.
APPEND objbin.
ENDLOOP.
DESCRIBE TABLE objbin LINES righe_attachment.
Text filling
objtxt = 'Testo della Mail - Riga 1'.APPEND objtxt.
objtxt = 'Testo della Mail - Riga 2'.APPEND objtxt.
objtxt = 'Testo della Mail - Riga n'.APPEND objtxt.
DESCRIBE TABLE objtxt LINES righe_testo.
Other filling
doc_chng-obj_name = 'URGENT'.
doc_chng-expiry_dat = sy-datum + 10.
doc_chng-obj_descr = 'Prova invio Mail con PDF'.
doc_chng-sensitivty = 'O'.
doc_chng-doc_size = righe_testo * 255.
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = righe_testo.
objpack-doc_type = 'RAW'.
APPEND objpack.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = righe_attachment.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'TEST'.
objpack-obj_descr = 'File.pdf'.
objpack-doc_size = righe_attachment * 255.
APPEND objpack.
Receivers filling
LOOP AT s_email WHERE sign = 'I'
AND option = 'EQ'
AND NOT ( low IS initial ).
CLEAR reclist.
IF sy-tabix > 1.
reclist-copy = 'X'.
ENDIF.
reclist-receiver = s_email-low.
IF rec_type IS INITIAL.
reclist-rec_type = 'U'. " Internet e-mail
ELSE.
reclist-rec_type = rec_type.
ENDIF.
reclist-notif_del = 'X'. " request delivery notification
reclist-notif_ndel = 'X'. " request not delivered notification
APPEND reclist.
ENDLOOP.
Mail Send
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
OBJECT_PARA =
OBJECT_PARB =
receivers = reclist
CONTENTS_HEX =
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7 -
Problem in script output sending mail
hi ,
I have a problem sending a mail with script output as attachment . I have searched in the forum for the answers but none is solved my question.
I am sending the data to the otf and it is getting the otfdata. but it is not showing the data on the script when it is sent as an attachment to the email , but it is showing only script with null values filled.( means i am getting the mail with attachment but in that attachment there is no data filled in the script send).
the code is like this ..
here i am filling the otfdata and i am exporting the otfdata
CALL FUNCTION 'ZMM_ARRANG_ENTRY_ABR_NATRAB'
EXPORTING
i_nast = nast
i_fonam = tnapr-fonam
i_xscreen = pi_xscreen
i_arc_params = arc_params
i_toa_dara = toa_dara
IMPORTING
e_retcode = px_retcode
EXCEPTIONS
OTHERS = 1.
IF ( sy-subrc <> 0 ). "Fehler
MOVE sy-subrc TO px_retcode.
IF ( pi_xscreen = 'X' ). "Ausgabe auf Bildschirm
MESSAGE ID sy-msgid
TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
*---Import OTFDATA from the memory
IMPORT it_otfdata FROM MEMORY ID 'OTF'.
ENDIF.
wa_maildata-obj_name = 'EMAIL'.
wa_maildata-obj_descr = 'Settlement Details'.
*-----mail contents
it_mailtext-line = 'Sub-sequent settlement Details'.
APPEND it_mailtext.
DESCRIBE TABLE it_mailtext LINES v_lines.
READ TABLE it_mailtext INDEX v_lines.
wa_maildata-doc_size = ( v_lines - 1 ) * 255 + STRLEN( it_mailtext ).
*Creation of the entry for the compressed document
CLEAR it_mailpack-transf_bin.
it_mailpack-head_start = 1.
it_mailpack-head_num = 0.
it_mailpack-body_start = 1.
it_mailpack-body_num = v_lines.
it_mailpack-doc_type = 'RAW'.
APPEND it_mailpack.
*-----Get OTF data
LOOP AT it_otfdata.
it_mailcont-line = it_otfdata.
APPEND it_mailcont.
ENDLOOP.
*---Move OTF data into binary table
LOOP AT it_mailcont.
MOVE-CORRESPONDING it_mailcont TO it_mailbin.
APPEND it_mailbin.
ENDLOOP.
*---Get no of lines in Binary data table
DESCRIBE TABLE it_mailbin LINES v_lines.
*---Fill name of the header of email
it_mailhead = 'Subsequent Settlement Details.OTF'.
APPEND it_mailhead.
*---Creation of the entry for the compressed attachment
it_mailpack-transf_bin = 'X'.
it_mailpack-head_start = 1.
it_mailpack-head_num = 1.
it_mailpack-body_start = 1.
it_mailpack-body_num = v_lines.
it_mailpack-doc_type = 'OTF'.
it_mailpack-obj_name = 'EMAIL'.
it_mailpack-obj_descr = 'Settlement Details'.
it_mailpack-doc_size = v_lines * 255.
APPEND it_mailpack.
*----Get email address from the address number of vendor
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_adrnum
TABLES
adsmtp = it_adsmtp.
*----Get mail address
READ TABLE it_adsmtp WITH KEY remark = 'AP_SUB_SETT'.
IF sy-subrc = 0.
it_mailrec-receiver = it_adsmtp-smtp_addr.
it_mailrec-rec_type = 'U'.
it_mailrec-com_type = 'EXT'.
APPEND it_mailrec.
*---Send email with PDF attachment
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_maildata
put_in_outbox = 'X'
COMMIT_WORK = 'X'
TABLES
packing_list = it_mailpack
object_header = it_mailhead
contents_bin = it_mailbin
contents_txt = it_mailtext
receivers = it_mailrec.
ELSE.
MESSAGE 'No email id Exist for the vendor' TYPE 'E'.
ENDIF.
please suggest me with your valuable answers .
Regards,
Venkat Appikonda.Hi venkat
Just check if this helps you.
The following part of the code does exactly that.
Selecting details from the spool request table.
SELECT * FROM tsp01 INTO TABLE tb_spool
WHERE rqowner = sy-uname.
IF sy-subrc EQ 0.
SORT tb_spool DESCENDING BY rqcretime.
CLEAR : tb_spool.
READ TABLE tb_spool INDEX 1.
convert spool into PDF format.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = tb_spool-rqident
TABLES
PDF = tb_lines.
ENDIF.
After this, on execution we get the below mentioned message.
This indicates that a PDF of the SAP Script has been created which is in the format u201C132-long stringsu201D.
In order to send the mail across, the mailing format of the PDF supports u201C255-long stringsu201D. So, the present u201C132-long stringsu201D needs to be converted into u201C255-long stringsu201D. This along with the mail code is mentioned below.
DATA: lv_receiver(50) TYPE c.
REFRESH: tb_obj_txt,
tb_obj_bin,
tb_obj_head,
tb_paklist,
tb_receiver.
CLEAR: tb_obj_txt,
tb_obj_bin,
tb_paklist,
tb_obj_head,
tb_receiver.
CLEAR: tb_adrc.
IF NOT tb_adrc[] IS INITIAL.
Reading the address table with the key as address number.
READ TABLE tb_adrc WITH KEY addrnumber = tb_kna2-adrnr.
IF sy-subrc EQ 0.
Vendor Email ID.
SELECT SINGLE smtp_addr
FROM adr6
INTO wf_mailaddr
WHERE addrnumber = tb_adrc-addrnumber.
IF sy-subrc EQ 0.
Moving the mail address to the receiver itab
MOVE wf_mailaddr TO tb_receiver-receiver.
tb_receiver-rec_type = text-011.
APPEND tb_receiver.
ELSE.
CONCATENATE text-004 tb_kna2-kunnr text-005 INTO lv_receiver
SEPARATED BY space.
If pa_call is initial, the receiver ID is printed; else an INVALID E-mail ID message gets flashed.
IF pa_call IS INITIAL.
WRITE :/ lv_receiver.
ENDIF.
CLEAR: itab.
itab-kunnr = tb_kna2-kunnr.
itab-message = lv_receiver.
APPEND itab.
EXIT. u201CNo mailing for invalid Email id
ENDIF.
ENDIF.
ENDIF.
wf_name = sy-uname.
wf_year = tb_main-bldat(4).
wf_mon = tb_main-bldat+4(2).
*This FM gives the name of the months.
CALL FUNCTION 'MONTH_NAMES_GET'
EXPORTING
language = sy-langu
TABLES
month_names = tb_months.
IF sy-subrc EQ 0.
READ TABLE tb_months WITH KEY mnr = wf_mon.
IF sy-subrc EQ 0.
wf_name = tb_months-ktx.
ENDIF.
ENDIF.
CLEAR: tb_contp.
IF NOT tb_contp[] IS INITIAL.
*Reading the contp itab as per the customer entered on the selection screen.
READ TABLE tb_contp WITH KEY bukrs = pa_bukrs
kunnr = tb_kna2-kunnr.
IF sy-subrc EQ 0.
CONCATENATE text-006 text-008 tb_contp-contp text-008 tb_kna2-kunnr
text-008 wf_name text-008 wf_year INTO wf_sub.
ENDIF.
ELSE.
CONCATENATE text-006 text-008 tb_kna2-kunnr text-008 wf_name
text-008 wf_year INTO wf_sub.
ENDIF.
Subject and Description
CLEAR wa_docdata.
wa_docdata-obj_name = text-007.
wa_docdata-obj_descr = wf_sub.
wa_docdata-obj_langu = sy-langu.
Write main body
tb_obj_txt = text-009.
APPEND tb_obj_txt.
CLEAR tb_obj_txt.
CLEAR tb_paklist.
tb_paklist-head_start = 1.
tb_paklist-head_num = 3.
tb_paklist-body_start = 1.
tb_paklist-body_num = 60.
tb_paklist-doc_type = text-012.
APPEND tb_paklist.
CLEAR tb_paklist.
create PDF file
Transfer the 132-long strings to 255-long strings
LOOP AT tb_lines.
TRANSLATE tb_lines USING ' ~'.
CONCATENATE wf_buffer tb_lines INTO wf_buffer.
ENDLOOP.
TRANSLATE wf_buffer USING '~ '.
DO.
tb_obj_bin = wf_buffer.
APPEND tb_obj_bin.
SHIFT wf_buffer LEFT BY 255 PLACES.
IF wf_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
DESCRIBE TABLE tb_obj_bin LINES lv_lines.
READ TABLE tb_obj_bin INDEX lv_lines.
lv_size = ( lv_lines - 1 ) * 255 + STRLEN( tb_obj_bin ).
Create attachment notification
tb_paklist-transf_bin = co_x.
tb_paklist-head_start = 1.
tb_paklist-head_num = 0.
tb_paklist-body_start = 1.
tb_paklist-body_num = lv_lines.
tb_paklist-doc_type = text-013.
tb_paklist-obj_descr = text-010.
tb_paklist-obj_name = text-010.
tb_paklist-doc_size = lv_size.
APPEND tb_paklist.
*mail the PDF to the receiver.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_docdata
sender_address = wf_name
sender_address_type = text-014
TABLES
packing_list = tb_paklist
object_header = tb_obj_head
contents_bin = tb_obj_bin
contents_txt = tb_obj_txt
receivers = tb_receiver
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
CONCATENATE text-003 tb_kna2-kunnr text-005 INTO lv_receiver
SEPARATED BY space.
CLEAR: itab.
itab-kunnr = tb_kna2-kunnr.
itab-message = lv_receiver.
APPEND itab.
IF pa_call IS INITIAL.
WRITE :/ lv_receiver.
ENDIF.
ELSE.
CONCATENATE text-002 tb_kna2-kunnr text-005 INTO lv_receiver
SEPARATED BY space.
CLEAR: itab.
itab-kunnr = tb_kna2-kunnr.
itab-message = lv_receiver.
APPEND itab.
IF pa_call IS INITIAL.
WRITE :/ lv_receiver.
ENDIF.
ENDIF.
Hope this helps.
Harsh -
Send a mail use FM 'so_object_send' with a Script form layout
Hi,
I try to send a mail use FM 'so_object_send', is it possible to use a sap script form for the layout?
Please give more details....Hi,
Did you debug and check this function module 'SO_NEW_DOCUMENT_SEND_API1' ?
As you said its giving you a sy-subrc = 2, did you check at what stage it is giving you an error ?
Also, Commit work = 'X' has nothing to do with this as you are getting an error of Sy-subrc = 2.
Also, while debugging are you getting the email address fetched from database table ? If no, then the sender's email has not been maintained. You will have to maintain the sender's email in the user details in SU02 under Address tab.
I would recommend you to go for BCS to send emails wherein you specify the sender email address directly in the program rather than adding email address in every user's logon details.
Regards,
Danish.
Edited by: Danish2285 on Mar 5, 2012 3:28 PM -
Basic traceroute EEM script (for hop-by-hop network analysis)
I'd like to do a hop-by-hop analysis by running a traceroute script that runs on an interval (say every 5-15 minutes) and puts output to a file.
The goal is to let the script run for a day, and see what kind of hop changes might occur over time, and also monitor for any latency increase or packetloss at certain times of day (peak hours).
If I used an EEM script to do a basic traceroute from one endpoint of the network to a server in the core (for instance), this could show how a client's path may be impacted during peak hours.
I'd want the output stored in a file on the router's flash disk, and then I'd have to find some way to parse and analyze the output later (not sure how I'd do that, perhaps with excel or another diff-like program).Something like this should work for you. In config mode, specify three EEM environment variables:
event manager environment traceroute_timer 600
event manager environment traceroute_target 10.1.1.1
event manager environment traceroute_file flash:/traceroute.txt
Then register this EEM Tcl policy:
::cisco::eem::event_register_timer watchdog time $traceroute_timer
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set arr_einfo [event_reqinfo]
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {
error $_cli_result $errorInfo
if [catch {cli_exec $cli1(fd) "traceroute $traceroute_target"} _cli_result] {
error $_cli_result $errorInfo
set fd [open $traceroute_file a]
puts $fd [clock format [clock seconds]]
puts $fd $_cli_result
close $fd
# Close open cli before exit.
catch {cli_close $cli1(fd) $cli1(tty_id)} result -
Hi,
I'm trying to email an alert by eem script when a catalyst 6807 rises a syslog message for an environment alarm (ex: power down). I use the attached script but when i want to add the syslog message in body email (line 83) something is wrong and i can't fixed the error : catalyst try to execute the syslog message (see email).
Same error for a catalyst 4507 4506 Sup 6L-E 10GE IOS 15.2(1)E but the same script works for a catalyst 4506 Sup 6L-E 10GE IOS 15.0(2)SG.
Any ideas ?
ThanksHi,
I found my mystake. In the script, I commented the command "enable" and thus show commands were not recognized by cli. The script has always worked well, "Invalid input" was the result of show command. For ios 15.2, i need to gain enable level.
So I suspect a different behavior between versions 15.0 and 15.2 for running level of tcl script. -
Sending E-mail to large number of recipients
Hi,
Note 598718 describes number of messages that is possible to send pr second if paralell prosessing is used:
"For all SAP technology Releases 6.xx, one of the next Support Packages will deliver a basic change of the SAPconect send job which will provide scalability of the throughput by using several parallel send jobs and/or application servers. This will allow a throughput of approximately 15 messages per second (about 1,000,000 messages per day)."
Does anybody know if this still is the limit (15 pr. second) in CRM 7.0 and if there is a way to improve this number?
Regards,
RonnyI thought about using BCC, but it seems a little messy although it would do the job.
Messy how? That's exactly what it's for. In fact, there's no other way to hide addresses from other recipients of the message. The only other way to do it would be to script automated sending of one message per address, and that would get quite messy!
What is the maximum number of recipients that Mail can handle?
There's no limit enforced by Mail, AFAIK. The limits come from the SMTP server you're using.
One of the issues I had when using Outlook on Windows for this by copying and pasting from a text document, was that if there was an invalid/non-existent address in the list, it would just return an error and I was never quite sure if the whole thing didn't send, or if it was just to the dodgy address(es).
In Mail, you'll just get a bounce message for any addresses that don't exist. The one exception to that is addresses on the same server that you're sending from... often, the server will simply reject the attempt to send to an address that it knows doesn't exist. I'm not sure what kind of message the server returns in that case, though, and suspect it depends on the server. It's been a while since I've seen such a problem. -
Send E-mail Send E-mail question
Hi,
Im trying out the Developers Toolbox and am trying to figure out if its right for me, and have very basic - beginning MySQL and php skills.
The tutorial at http://help.adobe.com/en_US/Dreamweaver/9.0_ADDT/help.html?content=ch12_send_email_01.htm l is rather sketchy, when I follow the tutorial on that page:
"The Send E-mail trigger allows the site developer to automatically send an e-mail when a form is submitted. It is an AFTER trigger, and it can be executed after insert/update/delete/custom transactions.
This trigger is accessible from the Application panel, Server Behaviors > + > Developer Toolbox > Send E-mail > Send E-mail."
well, when I try that, I get an error on the page which says:
"There are no insert, update, custom or login or delete transactions on page. Please insert an appropriate transaction first."
OK I am assuming that I need some kind of an html form open and on a page, however where do I start? Its as if the tutorials left out a huge chunk of the instructions. I realize I am no expert but if someone was buying the toolbox for the first time how would one know where to start? Do I need to create a new database table first? What kind of table? Can it be a table that is part of the site database for the shopping cart database that I already have linked to the store? Or does it need to be a seperate - database, table? Or just a php page with the form in it? Or does the form page need to be .html?
Or is the toolkit only for advanced developers with advanced php and MySQL skills and should I not even bother buying it?
Anyway can someone please give me a hint?
All I am trying to do is construct a simple email form for my web site which I have created in Dreamweaver and I need a php script to process the data inserted into the form and send it off to the mail server to forward to the webmaster's email address. I have the form created and brought up the form page, but then the Server Behaviors > + > Developer Toolbox > Send E-mail > Send E-mail. Tab is not accessible, and I am assuming that it wont be unless I have a .php file open, so I dont have a clue as to where to start.
So Ive got 27 days left to determine if its worth buying the toolbox, if I cant figure it out by then then I guess Ill buy some easier to use extension or stand alone to create my email form and other scripts.Hi DBS,
just some thoughts:
So Ive got 27 days left to determine if its worth buying the toolbox, if I cant figure it out by then then I guess Ill buy some easier to use extension or stand alone to create my email form and other scripts
honestly said: if sending form data via email is about all you want to achieve, buying ADDT or even trying to learn it would be overkill, as it comes with heaps of features which you´ll probably never need -- in this case investing in a stand alone form-to-email script seems a better solution.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
How to send automatic mail and put attache file on batch file ?
how to send automatic mail and put attache file on batch file ?
START MAILTO:[email protected]?SUBJECT=PHONE%CALL^&BODY=TestingHi,
Do you want to use a batch file to create new email message (including recipients, subject and email body) with attachments? If so, I'd recommend you post your question in the Scripting Guys forum for further assistance:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Please feel free to let me know if I've misunderstood something.
Regards,
Steve Fan
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs.
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Maybe you are looking for
-
Lync Server Front End 2 Hardware Load Balancer IP
I currently have the following Setup. I only have 1 Hardware Load Balanced IP for my Front End Pool. After running the Lync Planning Tool it actually states that i need 2 Hardware Load Balanced IP, 1 for internal and 1 for external. My question wou
-
Mapping 488.2 errors to NI iberr
Is there a mapping between iberr and 488.2 standard ESR bits (Command Error, Exec Error, Query Error and Device Err)? How does one relate to another? Does the NI driver set iberr based on the values in ESR? If so, what is done with a 488.1 device whi
-
Specific model not picking up advertisements
The other week I went to add the Powershell module to our Boot Images We encountered an error trying to do that, so we gave up, and built new boot images just to be safe. After doing so, and triple checking everything was exactly as had been previous
-
Apps not showing since update on 8-26-08
I synced my phone and i lost good programs i paid for. What can i do to get them back? HELP
-
SAP NetWeaver, Development Subscription
Has anybody here bought a "SAP NetWeaver, Development Subscription" that is being sold by SAP for $2300 in U.S? If so, can you tell me if this is a full-version IDES package with all SAP tables, function modules, etc? I have the free-downloaded "Snea