How to send 20 mail?
Hi i got one problem
I need to send about 20 mails with attachments in the same time.Has anyone has idea how to do it.
Thanks
OK thanks for link
but now how did you mean to put 20 different to,from,cc,bcc,subject,attach in
this transport object.
If i make some method for example:
public String send(String p_from, String p_to, String p_cc, String p_bcc,
String p_subject, String p_message, String p_smtpServer,String filename)
and in JSP page call this method
<%
String l_result = sendMail.send(l_from,l_to,l_cc,l_bcc,l_subject,l_message,l_smtpSvr,l_filename);
%>
how can i make it with Transport object ?
Must i call this method 20 times?
Need help
Message was edited by:
boske3
Similar Messages
-
How to send mail to distribution list ?
Hi Everybody,
Pls let me know how to send mail to distributed list???
Thanks & Regards,
raju<b></b>Hi ,
Use Function Module 'SO_NEW_DOCUMENT_SEND_API1'.
U need to pass Distribution list to Receiver and 'C' to receiver type refer the below code for clarification.
Determine the Distribution List.
gv_rec_list-receiver = gv_distribution.
gv_rec_list-rec_type = 'C'.
APPEND gv_rec_list.
Check if Distribution List is deleted.
SELECT SINGLE objnam
FROM soid
INTO lc_objnam
WHERE objnam = gv_rec_list AND
dlitp = lc_dli.
IF sy-subrc = 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = gv_doc_data
document_type = 'RAW'
put_in_outbox = 'X'
TABLES
object_content = gv_obj_cont
receivers = gv_rec_list
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4.
CASE sy-subrc.
WHEN '1'.
message i001(as) with 'TOO MANY RECEIVERS'.
EXIT.
WHEN '2'.
message i001(as) with 'DOCUMENT NOT SENT'.
EXIT.
WHEN '3'.
message i001(as) with 'DOCUMENT TYPE DOES NOT EXIST'.
EXIT.
WHEN '4'.
message i001(as) with 'OPERATION NO AUTHORIZATION'.
EXIT.
ENDCASE.
Hope this might have helped you.
Thanks,
Prashanth -
How can send mails using hotmail/rediffmail domain name?
I have used the below code to send a mail using javamail API?Even when I am sending my application does not have notified any of error/exceptions,But the message is not reached to I have given receipient's address in the to field.
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Sendmail1 extends HttpServlet {
private String smtpHost;
// Initialize the servlet with the hostname of the SMTP server
// we'll be using the send the messages
public void init(ServletConfig config)
throws ServletException {
super.init(config);
smtpHost = config.getInitParameter("smtpHost");
//smtpHost = "sbm5501";
smtpHost = "www.rediffmail.com";
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, java.io.IOException {
String from = request.getParameter("from");
String to "[email protected]";
String cc = "[email protected]";
String bcc ="[email protected]";
String smtp ="www.rediffmail.com";
String subject = "hai";
String text = "Hai how r u";
PrintWriter writer = response.getWriter();
if (subject == null)
subject = "Null";
if (text == null)
text = "No message";
String status;
try {
// Create the JavaMail session
java.util.Properties properties = System.getProperties();
if (smtp == null)
smtp = "www.rediffmail.com";
properties.put("mail.smtp.host", smtp);
Session session = Session.getInstance(properties, null);
//to connect
//Transport transport =session.getTransport("smtp");
//transport.connect(smtpHost,user,password);
// Construct the message
MimeMessage message = new MimeMessage(session);
// Set the from address
Address fromAddress = new InternetAddress(from);
message.setFrom(fromAddress);
// Parse and set the recipient addresses
Address[] toAddresses = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.TO,toAddresses);
Address[] ccAddresses = InternetAddress.parse(cc);
message.setRecipients(Message.RecipientType.CC,ccAddresses);
Address[] bccAddresses = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.BCC,bccAddresses);
// Set the subject and text
message.setSubject(subject);
message.setText(text);
Transport.send(message);
//status = "<h1>Congratulations,</h1><h2>Your message was sent.</h2>";
} catch (AddressException e)
status = "There was an error parsing the addresses. " + e;
} catch (SendFailedException e)
status = "<h1>Sorry,</h1><h2>There was an error sending the message.</h2>" + e;
} catch (MessagingException e)
status = "There was an unexpected error. " + e;
// Output a status message
response.setContentType("text/html");
writer.println("<title>sendForm</title><body bgcolor= ><b><h3><font color=green><CENTER>CALIBERINFO.COM</CENTER></h3>Your message was sent to recepient(s).<br><font color=red>"+"\n"+to);
writer.println("<br><br><a href=e:/mail/javamail/mail.html>back to compose</a>");
writer.close();
Please any one help me out from this probs.
Awaiting for yours reply,
or give me a reply to: [email protected]
Regards,
@maheshkumar.kHi,
how can send mails using hotmail/rediffmail domain name?In your java application,you specified www.rediffmail.com as your
smtp server.But that is the address of that website.Try will a smtp
server instead.For a list of free smtp servers,please visit http://www.thebestfree.net/free/freesmtp.htm
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support/ -
How to send mail in html format in jsp???
Hello everybody,
I have two jsp pages.In one page I have the heading like Date,Transaction.I am retriving data from my second jsp page.And I hae included the second jsp page to my first jsp page.How to send mail this content in html format.
Thanks
SrikantMimeMessage m = new MimeMessage(session);
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/html");this if u need to send a mail content as html -
How to send mail with attachment
Hi,
How to send mail with word document as attachment in oracle pl/sql.
kindly help me .
thank you
regards
P Prakashcreate or replace procedure pdf_mail(
p_sender varchar2, -- sender, example: 'Me <[email protected]>'
p_recipients varchar2, -- recipients, example: 'Someone <[email protected]>'
p_subject varchar2, -- subject
p_text varchar2, -- text
p_filename varchar2, -- name of pdf file
p_blob blob -- pdf file
) is
conn utl_smtp.connection;
i number;
len number;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => p_filename,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
demo_mail.end_attachment(conn => conn);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/html');
demo_mail.end_mail( conn => conn );
END;
ref:
http://www.plpdf.com/23-1725.html
Edited by: Mahanam on Jan 9, 2011 10:32 PM -
How to send mail in APEX 4.1 using PLSQL
Hi All,
How to send mail in APEX 4.1 using PLSQL?
Thanks In advance.
Regards
Shailhttp://lmgtfy.com/?q=oracle+apex+4.1+send+mail
-
How to Send mail in oracle 10g
I am new in oracle developer.....we are using oracle 10g developer...how to send mail through oracle 10g on a button click.pease help me.
Thanks in advanceThis question have been asked many times on this forum, see if you get help from following:
https://forums.oracle.com/message/5395438#5395438
Search results: https://forums.oracle.com/thread/search.jspa?peopleEnabled=true&userID=&containerType=&container=&q=form+email
Check this out as well:
http://nzchaudhry.wordpress.com/2013/05/31/send-report-via-email-attachment-in-oracle-forms-10g/
You can find init.ora or initSID.ora file under $ORACLE_HOME/dbs on linux and on Windows under $ORACLE_HOME/database. Otherwise you can create it using "create pfile from spfile" command
Aneel -
How to send Mail in case of Output Determination - Transmission medium 5
Dear Friends,
I have a below requirement.
- Create custom output type having Transmission medium 5, which triggers on creation of order.
- Write driver program attached to that output type that sends e-mail to the person who has created the order.
- Mail contain information regarding pricing for individual line item wise.
I have gone through many posts but not sure about process of generate the mail in case of Transmission medium 5.
My query is:
Do we require to write FM (SO_NEW_DOCUMENT_ATT_SEND_API1) to send e-mail to respective person or it will take care by system (Transmission medium 5)?
If FM not required then how can we write code that triggers the mail to specific mail ID?
NilayYes, for your custom requirement you will have to create a Z report.
LIke your requirement must be to put something specific in mail body or attach something with mail. All this will not be catered by the standard report maintained against your output type and transmission medium.
As i understand for any output type a message is triggerd and stored in database table (like NAST) and then these requests are picked by standard report (like RSNAST00). These reports then in return call the Program/form maintained against the ouptut type and transmission medium (table TNAPR).
So i would suggest that create a custom report and use the FM for sending mails. These FMs are pretty simple to use. Find a sample code in the below link:
[http://wiki.sdn.sap.com/wiki/display/ABAP/SendExternalMailwithattachment] -
How to send mail as a distribution list
I have created a number of distribution lists under the groups tab just to the right of mailboxes in the recipients section of the exchange admin centre in microsoft exchange 2013.
i have set permission on these mailboxes for send as to be permitted but when trying to send mail from outlook 2013, outlook web app or from ios i am unable to get the distribution lists email address to appear in the from list.
could someone please explain how i can resolve this for each of these 3 platforms?Hi,
Great advice from Veerapandian.
Based on my knowledge, Distribution List is based on Outlook, Distribution Group is based on Exchange server. You can grand send as permission to DG.
Send as permission is a permission based on AD, please make sure the DG can be resolved from GAL.
Please run following command to whether set “Hide this group from address lists” attribution, if so please remove this setting.
Get-DistributionGroup | FL alias,*HiddenFromAddressListsEnabled*
More details about Configure Distribution Group Properties, please refer to:
http://technet.microsoft.com/en-us/library/bb124513(v=exchg.150).aspx
Best Regards,
Allen Wang -
How to send mail to distribution list and another table list
Hi
I am facing a problem. I need to send mail to the user who is creating the SO/PO and a distribution list.
Problem is only one thing can be used at the same time. ie either Distribution list or list from internal table.
How can we use both in 1 function module. Like it should call the internal table and then the distribution list for sending the mail .
Regards,
VarunHi,
Refer to following link,
http://www.sap-img.com/abap/make-e-mail-sender-of-po-the-po-creators-name.htm
http://www.sap-img.com/fu016.htm
Reward pts. if helpfull.
Regards,
Dhan -
HOW TO Send mail while saving VA02
How can i send mail while saving VA02.
The mail address i have to pick from custom table based on plant.
Just for the trial we used : output type :KRML
Application : V1
Transaction medium :7.
and the program RSNASTSO routine SAPOFFICE_AUFRUF_VX is attached in the nace.
The same output type is attached in va02.If we use this output type with this medium , it is asking us mail partner
address also in the VA02.
but we have to get the mail partner from custom table.
And with this output type , the program attched in the NACE (RSNASTSO) IS NOT GETTING triggered.
But the mail is being sent to the mail partner which i mentioned in the VA02 Communication method.
How can i solve this.
Finally my requirement is i have to send a mail to exter id which is maintained in the custom table while saving VA02.
Regards
Ramakrishna LHi,
We had set a output type in NACE. and that output type we have in the VA02 transaction also.
But While saving the transaction it is not going through the program mentioned in the NACE for that output type.
But mail is sent to the SAP Inbox or official id .
how that mail is gone i am not understanding.
How can we do to go through the program mentioned in NACE while saving the VA02.
The mail body coming with text " sales order is blocked" sopme thing like this.
This same mail i have to sent to the mail id maintained in Custom table plant wise.
Regards
Ramakrishna L -
How to send mails in HTML format from the send mail step of workflow?
Hi,
I have a requirement where I need to send mails in the html format from the send mail step of the workflows.
But what I found out that the html tags are not renderd and as such the output is in plain text.
I know that there is an alternative of using an activity step and use my own custom code from within there,But due to certain business constraints, I need to use the send mail step only.
My SCOT settings are all right.
Please let me know how it can be done.
Thanks,
Samrat.Samrat,
It can't be done, you have to use your own activity step.
What are these constraints that refrain you from doing that?
Rgds,
Patrick -
How to send mails to multiple recipents using SO_DOCUMENT_SEND_API
Hi ,
I am using the FM "SO_DOCUMENT_SEND_API".
I am able to send an Excel sheet as attachement, but my requirement is to send multiple mails to the corresponding persons. I tried using coma, colan, semi colan as the separator in the import parameter SENDER_ADDRESS for two different mail id's but it was not useful.
I need to send mails to multiple recipens using the same FM. (keeping one person in to list and two of the persons in CC.)
can any on throw some light on this.
Thanks
rewards will be great.....................................Hi,
The code below demonstrates how to send an email to an external email address([email protected]),
where the data is stored within a .xls attachment.
Instead of the statement, <b>PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.</b>,
use select-options & give the e-mail addresses that you want.
*& Report ZEMAIL_ATTACH *
*& Example of sending external email via SAPCONNECT *
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
Hope this helps.
Reward if helpful.
Regards,
Sipra -
Dear friends,
please send me code how to send bulk mails from bsp,
sincerely yoursHi Ganesh,
Look at the following two blogs by Thomas...This will surely help you..!
<a href="/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface E-Mail from ABAP - Version 46D and Lower - API Interface</a>
and
<a href="/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface E-Mail from ABAP - Version 610 and Higher - BCS Interface</a>
This will surely help you.
<b><i>Do reward each useful answer..!</i></b>
Thanks,
Tatvagna. -
Please help, how to send mails faster / send more mails per hour
hello,
in my application i am using mail sender class i have created to send mail to the users to participate in a survey. following is the code for it. i would like to know if there is anything wrong in it coz it takes to much time to send the mails it is taking 2 minustes to send 6 mails i.e 360 mails per hour only.
following is how i instantiate the mail sender class and then generate a http link string dynamically as it is different for all the user.
//////////class where mail sender is instantiated////////////////////
try
setConnection();
st=con.createStatement();
rs=st.executeQuery("select * from "+CNAME+"_campaign");
String SurveyT = new String();
while(rs.next())
SurveyT = rs.getString(2);
rs.close();
rs=st.executeQuery("select * from "+CNAME+"_user");
ss = new MailSender();
while(rs.next())
String userid = rs.getString("userid");
String password = rs.getString("password");
StringBuffer message = new StringBuffer(BodyText.getText().trim());
if(SurveyT.equals("invitational") || SurveyT.equals("single"))
message.append( "\n" + "http://"+IPadd.getText().trim()+"/"+CNAME+"/servlet/login?username="+userid+"&passw="+password);
ss.send(FromField.getText().trim(),userid,SmtpServerID.getText().trim(),MailSub.getText().trim(),message.toString());
else if(SurveyT.equals("general"))
message.append( "\n" + "http://"+IPadd.getText().trim()+"/"+CNAME+"/Index.html");
ss.send(FromField.getText().trim(),userid,SmtpServerID.getText().trim(),MailSub.getText().trim(),message.toString());
st.close();
this.dispose();
catch(SQLException sqlex)
JOptionPane.showMessageDialog(null,sqlex.getMessage());
//Mail Sender class/////////////////
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import javax.swing.*;
public class MailSender
String sentAddr,fromAddr,smtpServer,body,subject;
public MailSender()
//function send to send the mail
public void send(String from,String to,String smtps,String subj,String messagetext)
fromAddr=new String(from);
sentAddr=new String(to);
smtpServer=new String(smtps);
body=new String(messagetext);
subject=new String(subj);
try
Properties props = System.getProperties();
props.put("mail.smtp.host",smtpServer);
Session session = Session.getDefaultInstance(props,null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(fromAddr));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(sentAddr,false));
msg.setSubject(subject);
msg.setText(body);
msg.setHeader("Survey","MailCheck");
msg.setSentDate(new Date());
Transport.send(msg);
catch(MessagingException mex)
JOptionPane.showMessageDialog(null,mex.getMessage());
}Lots of variables here....Also my maths says only 180 per hour.... i.e. three a minute.
1) you are using a database to get info from. What is the average response time of the DB server? Looks like you are doing one SQL then reading the result table but does the initial SQL take a while?
2) how much data are you passing on to the SMTP server and how fast/slow is the link to that SMTP server? Work out the absolute max amount of data you can transfer over the link then get your average message size and work out a VERY theoretical Max number of messages a minute. Note that real life might approach 80% of this taking TCP/IP and SMTP overheads into account.
3) What sort of load is the SMTP server under? If it's busy you will be only getting a fraction of whatever bandwidth is available. Depending on its design it may be trying to deliver the first message you sent it while you are still pumping more messages down to it. SMTP servers may limit the number of connections per minute from another machine in order to defeat a denial of service attack. Your code makes a connection per email so this may have relevence here.
4) Raw horsepower always helps. When I write stuff to do things like this there is no nice GUI screen etc. Just basic Java that if it has to will write a log if something goes wrong. Maybe just maybe a counter on STD out to show it is still actually doing something. Keep the number of classes used down to the bare minimum. In the old days we used to spend days paring code to the bone - a skill somewhat lost these days.
Hope this gives you some help in finding the bottleneck.
Cheers,
SH -
Newbie question: how to send mails on a Solaris 10 machine?
Good morning all,
I am responsible of a lab, containing some Solaris machines.
On one of those machines, a collegue would like to send mails, using following command:
echo "something" | mailx -v -s "subject" <collegue>@<domain>.comThe mentioned e-mail address is configured on an MS Exchange server.
On first sight this server is not accessible from the lab:
telnet>ping -a <Exchange_Server>.<domain>.com
ping: unknown host <Exchange_Server>.<domain>.comHowever when I try this in a DOS prompt, I get the same result:
DOS prompt>ping -a <Exchange_Server>.<domain>.com
Ping request could not find host <Exchange_Server>.<domain>.com=> How can I determine whether the Exchange server is accessible from the lab?
Even more general: how can I determine whether the machines in the lab are connected to the internet:
telnet>ping www.hotmail.com
no answer from www.hotmail.com(94.245.116.9)
no answer from www.hotmail.com(157.55.0.137)=> if there is no connection to the internet, how can my machine translate URLs into IP addresses?
Can anybody give me a start?
Thanksfirst ask your exchange team to add the Solaris server to exchange relay..then only soalris server can send mails...
once they added..
take the mail server ip/hostname
configure /etc/mail/sendmail.cf
modify DS to
DSmailserver ----if dns server works
else
DS[mailserver] ---lookup through /etc/hosts
Maybe you are looking for
-
Combined pdf files with garbage fonts
I need help with creating a combined pdf document. I start with word 2013, and use the styles to create a linked table of contents. Then Save As to a pdf. I deselect the Options to allow the links to work in the pdf format. Then I add other pdf's
-
IMovie 1 hour 47min. idvd says time exceeds 4.7gb disc? 911
i have been editing an imovie and the length of the film is 1 hour and 47 minutes long. I then SHARE with idvd and set it to BEST QUALITY and i use the REVELATIONS theme with pics and music for the scene selections but as i am dropping the pics and a
-
hi all ! Im needing to configure a date to be the first day of the next month we are atm. For example if we are now at second of march the date should be for april's first. This is how Im calculating it atm. String sfechap = ("01" + "/" +
-
I need to retrieve data from ZL table and prepare a report comparing the Actual, Previous and Old records in the table for an employee for a particular period. Are there any particular function modules for this data retrieval? Thanks.
-
How to Increase Bar Code width ?
Dear All, I am printing a Bar code and I am getting its width depending upon size of data . I am using CODE 128 and I am passing 854540008700547878 . I want to fix the bar code width 9cm ..Currently I am using 6cm width and 150 height . And If I inc