Auto send mail in next day

I want to create program that run in server. it can auto send mail to someone everyday. Do everybody know the way? pls help me. if you have the code example, pls send it to me. my emai: [email protected]
Thank in advance.

You need to create a java mail programme which has a main method.
You then need to set up the server to run the programme at a certain time of day.
Ask around about the crontab command on a linux server, this allows you to run a programme at a set time every day.
Just add a main method to the following class, add your smtp host and it should work
import javax.mail.*;
import javax.mail.internet.*;
/** This class uses the Javamail classes to send an
email with details of schedules etc
This java class was written by <a href="mailto:[email protected]"><b>Kevin
  Saunders</b></a> (<a href="www.salniere.com" target="_blank">www.salniere.com</a>)
class SendMail
    SendMail(){//constructor
Takes the email address of the recipient, the message and the smtp host as arguments
Then constructs an MimeMessage and sends it using the smpt host specified.
It returns a string which confirms whether or the email was sent.
     public String sendMail(String to, String from, String msg) throws MessagingException
    String status="";
    //String smtpHost=
    String smtpHost=
          try{ 
    //Create JavaMail session
   java.util.Properties prop= System.getProperties();
    Session sech= Session.getInstance(prop, null);
    //Construct a message
    MimeMessage message= new MimeMessage(sech);
    //Set the from address
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.setSubject("Email from "+from);
    message.setText(msg);
    Transport transport = sech.getTransport("smtp");
    transport.connect(smtpHost,"","");
    //send message and close connection
    transport.sendMessage(message,message.getAllRecipients());
    transport.close();     
    //Connect to the transport
    catch (AddressException ae){
    System.out.println("There was a problem with the email address "+to);
    catch (SendFailedException sf){
    System.out.println("There was an error in sending email from "+from+" to "+to);
    catch (MessagingException me){
    System.out.println("There was an unexpected error in sending your confirmation email, sorry");
     System.out.println(An email from "+from+ " has successfully been sent to "+to);
     return status;
    }//end sendMailMethod
}//end class

Similar Messages

  • Once I purchase a new application from Apple store by using credit card, I used to get the billing information in my mail the next day. But now a days it is not happening why?

    Once I purchase a new application from Apple store by using credit card, I used to get the billing information in my mail the next day. But now a days it is not happening why?

    Probably volume of purchases on Apple Systems
    by the way this is a user to user forum  no-one from Apple here

  • Auto Send  Mail Script?

    I am using a shipping program, that when I generate a new label it automatically send the info to mail app to send a tracking notification. problem, is that it only generates the email and does not send it. So if im sending 1000 pieces I have them all sitting on my desktop. Is there a script for mavericks I can use to send these without me hitting send on all of them?

    This should be easy as Automator has a "Send Outgoing Mail Messages" action however, this action has been broken since Lion.  I tried with Applescript, but couldn't get it working there either.
    Sorry.

  • Auto-send mailing list?

    Hi
    This is probably a really easy one but I've never used Automator before.
    I have a mailing list in the form of an Excel doc, each field in a different column, ie name, address, email address, phone, etc
    My question is this:
    Can I set up Automator to read the mailing list and send the same email to every email address in the list? Ideally customising each, eg. Dear John, Dear Peter etc.
    If it can't read the excel doc could I translate it into a group in Address Book and do it that way?
    Thanks
    Chris

    mmhm please send the ldif form this email-list
    This is an example of a email list ldif:
    dn: cn=mylist,ou=Groups,o=mydomain.com,o=isp
    uniqueMember: uid=ram,ou=People,o=mydomain.com,o=isp
    mgmanMemberVisibility: NONE
    mgmanJoinability: NONE
    mail: [email protected]
    objectClass: inetlocalmailrecipient
    objectClass: inetmailgroupmanagement
    objectClass: top
    objectClass: inetmailgroup
    objectClass: groupofuniquenames
    mailHost: mailserver.mydomain.com
    inetMailGroupStatus: active
    cn: Email Test List
    mgmanHidden: false
    mgrpRFC822MailMember: [email protected]
    mgrpAllowedBroadcaster: uid=ram,ou=People,o=mydomain.com,o=isp
    mgrpAllowedBroadcaster: mailto:[email protected]
    mgrpAllowedBroadcaster: mailto:[email protected]
    mgrpMsgRejectAction: reply
    Ram

  • "This message cannot be sent at this time."  I have been getting this pop-up for 3 days when trying to send out mail.  I don't know what to do!  I cannot send mail from this account on any ISP. Please help!

    "This message cannot be sent at this time."  I have been getting this pop-up for 3 days when trying to send out mail.  I don't know what to do!  I cannot send mail from this account on any ISP. Please help!

    lots of people seem to be havgin a problem sending email from iCloud webmail.
    does your email address have uppercase characters in it?
    if so, try creating an alias in lowercase (go to preferences in iCloud webmail and select 'accounts') and see if email sends okay from that

  • My iphone 4s sometimes wont show voice mail,sometimes wont ring just shows missed call,sometimes wont receive a text till next day. can anybody help me???

    My phone sometimes wont show voice mail,sometimes wont ring just shows missed calls,and some text messages wont show received till next day. Can anyone help?

    Settings > General > Reset > Reset Network Settings.
    Try reseating or replacing the SIM card.
    Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new). 
    Has any of the above been tried?

  • My itunes wont auto sync my iphone 4 after i connect it to itunes. But it can auto sync when i connect it to my old laptop. what's the problem that it can't auto sync and when i did a backup in my new laptop, it was corrupted the next day.

    But it can auto sync when i connect it to my old laptop. what's the problem that it can't auto sync and when i did a backup in my new laptop, it was corrupted the next day and i was forced to use back a backup which i did in my old laptop 4 months ago. do i have to reinstall the itunes? will my backups be corrupted after i sync again? pls guide.
    P.S/ its the latest version of the itunes whenever i did the backups.

    iPod touches or any iDevices from Apple sync only to one computer. If you sync to a different computer, all your music will be replace with the music from the new computer's iTunes. If the music were purchased from iTunes, you can re-download them again otherwise the music on iPod touch will be deleted. Do you have iTunes backup? 

  • I set iCloud up last week and the next day when out in the field I could not get Outlook to open up.  I want to change my settings so I can get mail at home or in the field

    I set iCloud up last week and the next day when out in the field I could not get Outlook to open up.  I want to change my settings so I can get mail at home or in the field, not just when i'm at home.  I have a PC and fios internet with Verizon at home.  I have a Sprint air card in the field or access an available wifi.  I want to change my settings to allow for receiving email in the field.  What's the point of an air card and icloud for backup fi it doesn't work in the field for some odd reason?

    Apple - Support - Mail Setup Assistant

  • I cannot send mail. Been so for 2 days. Get the message: An error occurred while sending mail. The mail server responded: Access denied

    When I send message the reply is "Access Denied" and a bunch of gobbly-gook ending with please re-check message. What would I check for? The G-G is of absolutely no value to the human species.
    An error occurred while sending mail. The mail server responded: Access denied...3c61d9886161c1c1b119b169f84d0c00bd1d41014c8da58d391805d17cbcdccd89e9557dcc85058535d178217d0831cc6d65.... Please check the message and try again.
    So what now. Mozilla must be the offspring of Microsoft in that help NEVER HELPS, EVER.

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings and disables most add-ons (extensions and themes).
    ''(If you're using an added theme, switch to the Default theme.)''
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu by clicking on the '''Restart with Add-ons Disabled...''' menu item:<br>
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.
    Thank you.

  • Workflow to send mail 20 day before the expiry date

    Dear All,
    I created a workflow to send mail when a calculated column date is equal to today as follows:-
    Step1
    add -20 days  to Current Item:Expiry Date (Output to Variable : date)
    then set variable : Notification1 to Variable : date
    Step2
    If variable:notification1 equals (ignoring time) Today
    email users
    Now when i add a new item to the list , the workflow status is set to In progress , and when i refresh the page the status is changed to Completed before the condition is met and!!
    Any help
    Regards

    If I Understood your question correctly, you need to send email to user 20 days before expiration date. 
    From above you workflow I can see, you are just checking your condition once a item is created. As your Step2 condition is not met your  workflow is completed without any error. I suggest you might want to try below workflow
    Step1
    add -20 days  to Current Item:Expiry Date (Output to Variable : date)
    then set variable : Notification1 to Variable : date
    then Pause until Variable:date
    Step2
    email users
    Above workflow design will pause you workflow till 20 days before expiry date. and then send email to user. 
    Please ignore syntax, I just tried to put logic.
    Below is explantion on how to use Pause Action(from MSDN) in Sharepoint workflow
    This action is initially displayed in a workflow step as Pause until this time.
    Use this action to pause the workflow until a particular date. You can add a current date, a specific date, or a lookup.
    Following are examples of what the action might look like in a workflow step,
    Pause until 1/1/2010 12:00:00 AM
    Pause until Variable: A week from Modified
    If this helps Please mark it answer or vote as helpful.
    Thanks
    Siddharth

  • When I set up my mail I could send emails now a day later I can not send them but can still receive them ... I can't see what is wrong .. Any answers .

    When I set up my mail I could send emails now a day later I can not send them but can still receive them ... I can't see what is wrong .. Any answers .

    It's not a good idea to use a network disk for both Time Machine backups and other things.  By design Time Machine will eventually consume all the space on its output disk, which will then cause problem for your other files.  I'd store those other files on an external disk connected to the Time Capsule.  The problem with that is that Time Machine will only back up files that are local to your Mac.  That means that you'll only have one copy of the files on or attached to your Time Capsule.
    By the way, you've been misled by poor field labeling on this forum into typing a large part of your message into the field intended for the subject.  In the future just type a short summary of your post into that field and type the whole message into the field below that.

  • Why does mail auto send a blank reply?

    Why does Mail auto-send a blank reply to every new email I receive?

    One of your mail rules may be doing it.

  • I lost an Iphone 5 and got a new one on the next day by mail but it still doesn't work, what I need to do to activate the phone?

    I lost an Iphone 5 and got a new one on the next day by mail but it still doesn't work, what I need to do to activate the phone?

        Let's ensure we get this new device up and running, 123Vika. I know the importance of having a functional device. I have some great news you can activate the device directly from My Verizon. Take a look; http://vz.to/1gdvahs
    YosefT_VZW
    Follow us on Twitter @VZWSupport

  • Mail Exchange 2013 auto send some email to strange domain

    My mail server is ok now. i can send and receive fast.
    but some time it is auto send email to strange domain and continuous send to [email protected] 
    PLEASE HELP ME, thanks
    Identity: Mail01\30101\25804163514390
    Subject: Undeliverable: TODAY: Apple Macbook Pro for $23.38?
    Internet Message ID: <[email protected]>
    From Address: <>
    Status: Ready
    Size (KB): 12
    Message Source Name: DSN
    Source IP: 255.255.255.255
    SCL: -1
    Date Received: 4/10/2014 8:08:02 PM
    Expiration Time: 4/12/2014 8:08:02 PM
    Last Error: 400 4.4.7 Message delayed
    Queue ID: Mail01\30101
    Recipients:  [email protected];2;2;400 4.4.7 Message delayed;0;CN=Directly to Internet,CN=Connections,CN=Exchange Routing Group (DWBGZMFD01QNBJR),CN=Routing Groups,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative
    Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=elgaucho,DC=asia
    AND 
    Identity: Mail01\158323\14873471746194
    Subject: Delivery delayed:Inbound proxy probe
    Internet Message ID: <[email protected]>
    From Address: <>
    Status: Ready
    Size (KB): 10
    Message Source Name: DSN
    Source IP: 255.255.255.255
    SCL: -1
    Date Received: 12/25/2013 4:48:12 PM
    Expiration Time: 12/27/2013 4:48:12 PM
    Last Error: 400 4.4.7 Message delayed
    Queue ID: Mail01\158323
    Recipients:  [email protected];2;2;400 4.4.7 Message delayed;0;CN=Directly to Internet,CN=Connections,CN=Exchange Routing Group (DWBGZMFD01QNBJR),CN=Routing Groups,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First
    Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=elgaucho,DC=asia

    Hello,
    As the Vishwanath's provide the article, Exchange 2013 automatically creates several HealthMailbox<guid> objects in Active Directory which are used by Managed Availability to send e-mails through Exchange to verify mail flow every few minutes. These
    e-mails are used to do health checks for resources from Frontend Transport role to Hub Transport and health checks on mailbox database resources.
    Additional article for your reference.
    http://exchangeserverpro.com/exchange-server-2013-inboundproxy-com-ndr/ (Note: Microsoft is providing this information as a convenience to you. The sites are not controlled
    by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link)
    Cara Chen
    TechNet Community Support

  • How to block a Sender from Sending Emails but Auto Reply Set on That Id should be able to send mails .

    hi ,
    I need to block a certain Email id from sending mails , but at the same time auto reply should work and any mail received by that id an auto reply should be generated .
    Please guide me m a not an exchange pro.
    Thanks

    Hi,
    I have some tests in my lab using Exchange 2010. I recommend you create a transport rule to prohibit a user from sending emails. Here is an example for your reference.
    And then use the following cmdlet to set the auto reply for this user.
    Set-MailboxAutoReplyConfiguration -Identity "amy02" -AutoReplyState Enabled -ExternalMessage "External OOF message here" -InternalMessage "Internal OOF message here"
    Here is the result.
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

Maybe you are looking for

  • Question about SLM2008

    I got three domain on the same network. Trying to set up a vlan to split all the computers to respective domain. This is my setup i got 5 static IPS. The respective IP runs to a wireless router which then runs to a server and to the SLM2008 router. N

  • Edge animate will not work, loads with screen gibberish

    When I start Edge animate I cannot do anything with it. I can't open a file, create a new file and I see a bunch of gibberish and weird paths on the home screen. I have re-installed the program numerous times and it doesn't help the matter. Any assis

  • ASA5505 L2L VPN does not function after move and reconfiguration

                       I have an ASA5505 that had multiple VPNs to both Cisco5505's and other Vendor security appliances.  The one in question that moved to a new IP address checks out on isa sa, ipsec sa and nat, yet there is no communication accross th

  • Why an InfoObject can't be brought into an InfoCube?

    I am trying to bring in an InfoObject into an InfoCube, but this InfoObject doesn't show up in the Template section under the tab of Characteristics of this InfoCube that I can not drag it over from the right hand side of the Template to the left han

  • 20" iMac Shipping Size and Weight

    I want to purchase a new 20" iMac and take it with me by air for an extended trip. What is the size and weight of the 20" iMac in its shipping carton?