Sending emails automatically

does anybody know how to send emails automatically if it meets the requirement, for example, will send emails automatically if an account balance is less than $100? are there any codes to guide me?

Here's some code, just pass in the to, from, subject, and body in the constructor... You'll have to tweak the mail server ip's, etc... You need mail.jar, which is available somewhere on java.sun.com.
I just use it to send email from my appserver, and I'm not using all the capabilities.. You can send attachments, multi-part mime, etc.. This class can easily be modified to do spamming, mailbombs, or newslists.
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailer{
    public Mailer(String to, String fr, String subj, String mess1) {
        System.out.println("class Mailer sending a msg..");
         String from = null;
         String toUser=null;
         String host = "mail.yourdomain.net";  //MAIL SERVER HOSTNAME
         boolean debug = false;
         String msgText1 = "";
         String subject = "";
        try{
            toUser = to.trim();
        }catch(Exception e){to = "[email protected]";}
         try {
             msgText1 = mess1.trim();
         }catch(Exception e){}
         try {
             from=fr;
         }catch(Exception ex){}
         // create some properties and get the default Session
         Properties props = System.getProperties();
         props.put("mail.smtp.host", host);                   //to be honest, i have no idea
         props.put("mail.user","[email protected]");//what these 2 lines are for..
         Session session = Session.getDefaultInstance(props, null);
         session.setDebug(debug);
         try {
             // create a message
             MimeMessage msg = new MimeMessage(session);
             msg.setFrom(new InternetAddress(from));
                InternetAddress[] address={new InternetAddress(toUser)};
                try {
                    address[0].setPersonal(null);
                }catch(Exception ex){System.out.println("couldn't null out personal info in address[0]");}
             msg.setRecipients(Message.RecipientType.TO, address);
             msg.setSubject(props.getProperty("user.dir"));
             // create and fill the first message part
             MimeBodyPart mbp1 = new MimeBodyPart();
             //mbp1.setText(msgText1);
             // create the Multipart and its parts to it
             Multipart mp = new MimeMultipart();
             // add the Multipart to the message
             msg.setContent(mp);
             // set the Date: header
             msg.setSentDate(new Date());
             msg.setText(msgText1);
            try {
                subject=subj.trim();
                msg.setSubject(subject);
             }catch(Exception ex){System.out.println("no subj..");}
             // send the message
             Transport.send(msg);
         } catch (MessagingException mex) {
             System.out.println("error in DPWMailer: "+mex);
             mex.printStackTrace();
             Exception ex = null;
             if ((ex = mex.getNextException()) != null) {
              ex.printStackTrace();
          //{{INIT_CONTROLS
     //{{DECLARE_CONTROLS
}

Similar Messages

  • How to send emails automaticly?

    Right now I am trying to write a Java program whose purpose is to send a group of people their monthly bill automatically.
    The program should be running like this:
    When I click the "send" button at the end of each month, all the bills should go to the right email boxes (the bill files should be attached to the email). Now I am having a hard time figuring out how to send an email AUTOMATICALLY. Can anybody give me a brief idea about how to do it? I'd appreciate it very much!

    http://developer.java.sun.com/developer/onlineTraining/JavaMail/

  • Send email automatically

    Hi all,
    I am a newbie. I have an application in which in one of the pages i'll take orders and want to send email confirmation automatically after creating the order. That is my task.
    But in order to do this First i have to install apex_mail package. This is where I got the issue.
    it is asking me yo install utl_mail package.
    so now i'm totally confused, Can somebody please help me(direct me) with a step-by-step instructions to setup and configure smtp in my application.
    I am using apex 3.2.1

    You have to login into Oracle apex as administration, not into workspace but into oracle apex_admin and in there you can go to
    Home>Manage Service>Instance Settings
    you can configure
    SMTP Host Address
    SMTP Host Port
    Administration Email Address
    Notification Email Address
    and then you can use the apex_mail.send package from a page process to send an email

  • IPhoto sending emails automatically?

    I recently received a bizarre email from my mother with the subject "52 great iPhotos". The author of the email was "Administrator <[email protected]>" (it was her email address, though she doesn't use the word "administrator") and the body of the email contained 52 photos from her iPhoto library.
    Trouble is, she never sent such an email. Could iPhoto be sending photos without her knowledge/consent? Could that be a virus?
    Anyone have any ideas?

    I would suggest that she change her password for that email account.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier versions) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. There are versions that are compatible with iPhoto 5, 6, 7 and 8 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    NOTE: The new rebuild option in iPhoto 09 (v. 8.0.2), Rebuild the iPhoto Library Database from automatic backup" makes this tip obsolete.

  • Convert invoice to PDF format and send email automatically

    Hello,
    We have a requirement weherin when a billing document is created in SD with transaction code VF01, the invoice should automatically get converted to PDF and mail should be sent to the customer's external email id.
    Please seggest how this can be done.
    RR

    check this Email Invoice as PDF

  • Send email automatically when a process message errors out in CO54.

    Hi,
    I am looking for a standard method to send an email to the user when a process message errors out in CO54.
    Is there anyway to do it in standard SAP system? Please let me know.
    Thanks!

    did you enable the email notification on the issue list...... List Settings -> Advance
    Settings option. 
    check this, step by step guide.
    http://ceekam.com/blog/?p=1137
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Yahoo Mail in Iphone sending emails automatically

    Attached is the screen shot of my freinds email.
    I am not sure what is going on. I changed a password a week ago in yahoo to stop this but seems like this is happening again. Is there any way I can stop this.

    You may need to change your password again.

  • I would like to go to firefox to send emails automatically. for example, to reply to an oline item for sale, my system takes me to safri eamil. how can i chnage my settings to go to firefox. thanks. tim

    not too sure what else that I could add to give you more info.

    Firefox doesn't do email, it's a web browser.
    See this to change the email program or webmail provider that Firefox uses for '''mailto''' hyperlinks on webpages. <br />
    http://support.mozilla.com/en-US/kb/Changing+the+e-mail+program+used+by+Firefox

  • Send email based on the date

    Hi,
    Does any one know how to send emails automatically based on a date. For example in the database we have birth days of all employees. All the employee details are being maintained using a JSF web application. An email has to be sent as birthday reminder. If any one has any ideas as to how to accomplish this from a webapplication or database please let me know.
    Thanks a lot,
    HeMan

    If U are usingOracle db, then there is a plsql package called ut_mail. It has a procedure that sends emails :
    utl_mail.send(sender => 'myName',
    recipients => '[email protected]',
    subject => myTopic',
    message => 'myMessage',
    mime_type=>'text/plain; charset=ISO-8859-2'); If U want to do it in java, write application and use JavaMail.
    Martin

  • Sending email from bash

    I need to send emails automatically and regularly triggered by an event.
    For the sake of simplicity and robustness i chose mail / mailx.
    Sympthom: 
    . I can send email to myself using my own MBP name [email protected]
    . I cannot send any email to outer addressees
      in /var/mail/mine  I got errors either "Connection refused" or "No route to host"
      that is in case of gmail.com domain.
    . Than I tried to configure mailx to use remote mail server  smtp.gmail.com:587
    (this one is used by my mail in Lion )
    Here is the ~/.mailrc congfig
    alias MYGROUP xxxx yyyy zzzz
    set smtp-use-starttls
    set ssl-verify=ignore
    set smtp=smtps://smtp.gmail.com:587
    set smtp-auth=login
    set smtp-auth-user=[email protected]
    set smtp-auth-password=mypass
    I started mailx -n -v so the mailrc was used since the delivery report showed all three mails but
    resulting in the same errors above and using the port 25 as if all set commands were ignored.
    Question: Is there a way to have it worked with this kind of configuration, if so what did I wrong.
    (They say it works in Linux / Solaris environment)

    Unfortunately that has made no difference. While connected on wifi Ive tried sending a mail. At the top of the screen next to the wifi sign there's something going round and round. At the bottom of the screen it says "sending".

  • How to send emails using Automatic Work Items in Collections using XML Publ

    Hi,
    We are using XML Publisher to send correspondances in Advanced Collections.
    We want to send email correspondances using Automatic Strategy Work Items.
    Can anybody please help on how to send these?

    I believe you have to define your dunning template and assign that template to the strategy work item.
    Let me know if you are still not able to do it.
    Thanks,
    Anil

  • BP Activity send outlook email automatically while adding or updating an activity

    Hi All,
    We are using SAP B1 9.0 .In Activity screen we are assigning Tasks and meeting to our customer and internal sap users .Is it possible to send an oulook email automatically when i ADD OR UPDATE  a Task or activity.Please give your valuable comments.

    Hi Sri,
    The e-mail send to outlook integration is a manually executed task from within SAP Business One.
    Unfortunately in the current release, there is no automation built in.
    Please refer to The SP_TransactionNotification Stored Procedure
    There is an option for post (after the transaction os added in SBO) transaction notification that can be used, that you can query information and despatch via an email.
    Note that you need to configure the SQL mailer as well for this to work effectively.
    Regards,
    Kiran

  • I want to build a website that can send out email automatically using c#

    I want to build a website that can send out email automatically using c# and sql server when a date has reached. I have googled but nothing works.
    http://www.quartz-scheduler.net/documentation/quartz-2.x/tutorial/using-quartz.html
    I came across this, but I am still unsure what to do. 

    I came across this, but I am still unsure what to do
    http://forums.asp.net/

  • TS3899 iPhone 5s Mail app shut down automatically when try to send email

    I just set up new iPhone 5s two days ago from iPhone 5.
    Everything works fine except Mail app.
    Due to Mail app, I had to set up new configuation instead of back up from old iPhone 5.
    Mail app works fine 1 day, but after the day after, the mail app shut down automatically when try to send email.
    Just one specific email account has problem. It worked fine on iPhone 5. Same setting on Pop and SMTP. Exactly same~~
    - I did try to reset iPhone 5s pressing home button and sleep button for 10 second. It did not work
    - I did try to reset all information and install iPhone 5s and the problem still exists.
    - I did try to delete specific email account and re-make it, but it did not work
    Funny thing is that if Lanuague is English, then sending email is working. Absolutely no problem.
    However, if Language setting is Korean, then Mail App shut down automatically.
    I'm heavy email maker and if it is very annoying.
    Does anyone have same issue like this?
    I believed it is iOS7 bug?
    Can anyone help me on this???

    Am having similar problems with a new iPad Air. It will recieve email in Mail as directd from my domain email account. It will not send, advising server does not recognise account. I have checked and re checked settings.
    My computer and old iPad work perfectly. Any ideas would be really appreciated.
    By the way sending email directly from the domain email account works perfectly but I prefer using Mail.
    James

  • I'm trying to off my email but when i go through mail,contacts,calendar it send me automatically to main screen. Any help pls??

    I tried to restart so many times but still not working, now my email is open and everybody can check it. Pls help

    I'm not at all sure about this - if it has any bearing is what I mean - do you have restrictions turned on?
    Settings>General>Restrictions>On.... if you do have it turned on, that can prevent anyone from making changes to email accounts. But the way you describe what is happening - it sounds like the Mail, Contacts, Calendars Setting is crashing for some reason. "Send me automatically to the main screen" sounds like a crash - that is what apps do when they crash or quit unexpectedly.
    I don't use restrictions and I've never seen them "in action" so to speak. I just assumed that if you had restrictions enabled, the setting is greyed out and "unselectable" if you will.
    The only other things I can think of that you can try are to reset the iPad and then restore it if that fails.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    If the setting went bad, I know of nothing else to try other than to restore.

Maybe you are looking for

  • How to display word document as a HTML document in portal

    Hi I developed a portal application in that i am displaying word document using IFrames, from my application i am uploading word document and saving those document in KM Requirement is that i need to provide an option to show this word document in ht

  • Videos in a Mobile App

    I want to build a mobile application (focusing on Android) where I can allow the user to choose from a set of preloaded videos (.MP4, but I can probably do other formats, to include flash - since I'm focusing on android). This is an early proof of co

  • 60w chargers not working on 13-inch MacBook but 85w does. What is wrong?

    Hi. My 60w charger won't work on my 13-inch MacBook, so I tried 2 others including one brand new one but none worked. Then I tried a charger from a 15-inch (85w) and it worked. ***!? I was told that I shouldn't use the 85w because it could fry my bat

  • HRFORMS Workplace Infotype 0008 in generated print program

    Hi folks We have a problem with generated print programs for time sheets. Generated by the HRFORMS workplace. Even when the workplace generate the printprogram for the SmartForm, accordingly a code line is generated as the 1st in the PrintProg. INFOT

  • QP01 - Signification of Usage , Status and CAPP Order

    In QP01 what does (A.)  USAGE , (B.) SATUS & (C.) CAPP STATUS signify. Usage                                   Description 1.     Production   2.     Engineering/Design 3.     Universal 4.     Plant Maintenance 5.     Goods Receipt 6.     Goods Issue