How to specify an SMTP port rather than 25 in JavaMail?

This is my segment of code, but I don't know where I can specify the SMTP port. Please help me.
Properties props = System.getProperties();
props.put("mail.smtp.host", "smtp.mail.yahoo.com");
Session session = Session.getDefaultInstance(props,
    new MyAuthenticator("dxxvi", "nopassword"));
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]",
                                    "Thai Dang Vu"));
message.addRecipient(Message.RecipientType.TO,
    new InternetAddress("[email protected]"));
message.setSubject("I test the Yahoo! Mail Plus service");
message.setSentDate(new Date());
Multipart multipart = new MimeMultipart();
BodyPart bodyPart = new MimeBodyPart();
bodyPart.setText("If you can read this, $19.99/year is worthy");
multipart.addBodyPart(bodyPart);
bodyPart = new MimeBodyPart();
bodyPart.setDataHandler(
    new DataHandler(new FileDataSource("Resume.doc")));
bodyPart.setFileName("Resume.doc");
multipart.addBodyPart(bodyPart);
message.setContent(multipart);
Transport.send(message);

props.put("mail.smtp.port", "42");

Similar Messages

  • How to specify application by extension rather than mime type (e.g., docx as word, not xml)

    When I try to open a link to a file.docx or file.xlsx, FF sees it as an xml file and wants to open it in my default xml application. I can select Word or Excel (I have Office 2010 installed), but a) it doesn't remember that in the applications list, so I have to browse applications each time, or b) if I set it to always use that type, it tries to open docx in Excel or xlsx in Word, depending on last usage. How can I specify applications by file extension instead of seeing these as the same type of file?
    Thanks,
    Ian
    FF 15.0.1, Win 7, Office 2010

    I don't know if the source server sends the right mime type - it probably doesn't. In fact, now you mention it, I'm not sure I've tried this from any sites except one, which is the one giving me problems. I'll try contacting them about fixing their mime types. Assuming though that they can't or won't fix it, the question still remains - is it possible to set application by extension rather than by mime type?
    Yeah, I can definitely save it and open it, just trying to take the easiest possible route for a quick view.
    Thanks.

  • How do I download a PDF rather than viewing it in Safari?

    How do I download a PDF rather than viewing it in Safari?
    Version 5.1.3

    I believe you can save it after it is viewed in Safari.
    Barry

  • How to get the actual value rather than pixel value in vision assistant

    how to get the actual value rather than pixel value by vision assistant in my program.As shown in the figure            this is my programme   this is the result       But i want to get this result

    Check the documentation for the "ADF Dialog Framework"
    It may help
    Atilio

  • How do I restore from iCloud rather than from backup point from six months ago?

    how do I restore from iCloud rather than from a backup point from six months ago? on iTunes I don't see the option to select. can I restore and see this option directly from the iPhone?

    Welcome to the Apple Community.
    iCloud BackUp and Restore

  • How do i delete a letter rather than backspace

    how do i delete a letter rather than backspace

    If you  touch the end of the word, you get a magnified "bubble" that you can drag to the right edge of the character you want to replace, then one backspace deletes it and you type the correction. For straight typing ,it's easier just to use the delete key, but I sometimes use the bubble method when typing Latin, because I must enter a lot of long vowel signs that are a pain to retype.

  • Specify domains to proxy rather than to bypass

    In the Network Preference Pane for setting up a proxy there's a field to add domains to bypass. Rather than setting the domains to bypass I'm wanting to be able to set the domains to include. Is there a way to setup my machine so that I only route traffic for specific domains thru the proxy server?
    Thanks.

    Perhaps this would be of use?
    http://wiki.garylaw.net/doku.php?id=technical:automaticproxyconfiguration

  • How to switch a realy once rather than repeatedly

    Hi,
    I am using a TB-2627 terminal block in a PXI-2527 relay multipleaxer and i am having trouble switching a relay.
    In the terminal block i have a simple pos and neg which goes out to a enable button on my rig. I want to open and close this relay. I have taken part of the relay switching example but no matter what i try, when i press "close relay" rather than just staying closed it keeps openeing and closing really fast continuously.
    Can anybody help me or share a bit of code that will enable me to simply keep the realy open or closed?
    Kind Regards,
    Kieran

    Hi!
       Just post your code! 
      I guess that switching is inside a while loop that is continuously launched...looking at your code would help!
    graziano

  • How to Specify the SMTP in case of https protocol

    Hi.
    i have some doubt...
    i am going to develop the mailing application ,for sending the mail we need to specify the SMTP host right?
    in my case suppose mail.server.com this is my SMTP host that we need to specify in the Code.
    but but m this host uses the https Protocol menas...
    it open the webpage with https://mail.server.com
    not with http://mail.server.com...
    please tell me my changes i need to do in the code.....or pls give me some code example for using this senario...
    waiting for +ve response.
    Thanks,
    Ashu

    Hi bshannon ,
    Actually i am very new in this functionality.........
    sorry i am not understnd what u want to say...
    Please give me brief description for the same...........
    Edited by: EJBUSER on Oct 3, 2007 6:24 AM

  • How to configure a listener to listen on a different port rather than 1521 and register it on the database

    Hi Everyone,
    I have used 11gR2 RAC for a couple of years and now I've got this issue because I have tried to setup more than one database on RAC infrasturcture:
    I have an existing database on my RAC. (lets call it orcl) which is listening on port 1521 and is functioning properly. Now I want to create anoher database (call it test) which is going to listen on port 1526. I am able to create a listener using netca, (as oracle recommended, I've created it with grid user). I am also able to create a database using dbca (with dba user). My problems stem from when I want to configure listener to register with the new database. If i set local_listener to my newly configured database, it won't be able to tnsping and therefore login. If I create tnsnames.ora file on local or remote server, I am able to ping the database, but when I want to connect using sql*plus (or any other client) I receive TNS-12514 error. By the way, I am using AIX 7.1 as my machine.
    Let me know if any more info is required on this topic.

    > Now I want to create anoher database (call it test) which is going to listen on port 1526.
    Why? What is the purpose of using another listener? An Oracle Listener was designed to service multiple databases running on the same server. In all my years of working with Oracle and running multiple databases on the same machine, I have yet to be required to run more than one listener. And almost every single time I've seen someone try to provide rationale for multiple listeners, the technical reasons have no merit.
    > If i set local_listener to my newly configured database
    The LOCAL_LISTENER parameter does not point to a database...it points to a LISTENER!
    LOCAL_LISTENER=(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1526))
    Cheers,
    Brian

  • How to specify a local port but it should not be bound

    Hi all,
    i am developing a client app that connects to a server...
    for example i have the constuctor of a socket that connects to a server..the server requires the ipaddress and local port of the client for security reasons...so my socket constructor looks like this client = new Socket (remote ipaddress, remote port, local ipaddress, local port) ..this works fine...but the problem is that the server sends messages to the local port.....how do i make sure that java does not bind..the local port..i mean for it to be freed..cos it seems java is binding it.
    Thanks.

    there is a Server (Not a java program) that requires
    clients to connect to it using the following kind of
    connection below:
    a java client connects to the server with this socket
    constructor
    Socket ss = new Socket (remote ip, remote port, local ip, local port);This is your first problem. There is no such kind of server. The server will know the client's local port regardless of which Socket constructor the client uses, as someone else pointed out. Leave out the last two parameters.
    now the
    server sends responses to the local port specified in
    the constructor of the socket.or the local port assigned by the system if it wasn't specified, as it almost always shouldn't be.
    I need to create a listener on the localport
    so i can read the information sent in from the serverAHA!!!!!!! NO YOU DO NOT. You need to execute a read on the client socket. That's what it's for. It already represents an established connection between a client local port and the server.
    ..creating
    this ServerSocket ss = new ServerSocket
    (localport); in jave generates an "Address
    Already in Use Exception".As expected. It is.
    now what i asked was "how
    can i unbind the local port form the socket so java
    will not tell me it is already in use when creating a
    listener on it in ServerSocket".You don't want to do this as explained before. FYI you could close the Socket to release the port, but you will then discover that the server sends fail because it tries to send to the established connection.
    I hope this is clear now.Clear as mud. What is clear is that you do indeed need to read up on TCP/IP as recommended by several other posters. Your grasp is very slender.

  • How to specify which Ethernet port on a Mac Pro to send an Ethernet packet

    Hi,
    I am doing some development on a Mac Pro. The Mac Pro has two Ethernet ports on the rear: Ethernet 1 and Ethernet 2.
    I want to specify which of these ports I send a UDP Ethernet packet from.
    In my code I currently create a socket and send data through this. This works fine, but the data (packet) always seems to come out of Ethernet port 1 on the rear of the Mac Pro.
    So, how / where do I set in my code which port (Ethernet 1 or Ethernet 2) on the back of the Mac Pro to send my packet out of?
    Cheers!
    SkinnyC

    It's ok, found this
    http://lists.apple.com/archives/macnetworkprog/2008/Feb/msg00070.html

  • How to specify one ethernet port for network home directories (other for normal filesharing)?

    So I'm trying to get Home Directories up and running on a 10.6.8 Xserve (waiting until I get my NFS sharepoints migrated to a Linux server [for other reasons] before moving up to 10.7 Server). But posting here since that will be happening in the next few weeks, and it might be applicable now (so I can at least get that resolved ahead of time).
    I have a different DNS entry for each ethernet port: server.office.domain.com at 192.168.0.11 for the first, and homes.services.internal at 192.168.0.10 for the second. DNS lookups for both resolve correctly (as does the reverse lookup).
    If I use the Server Admin to pick a sharepoint as an automount for Home Directories, everything is fine, but it picks the server.office.domain.com hostname. Picking that works just fine, but that is also the connection that feeds the filesharing. I'd prefer to split that home directory traffic out onto the second ethernet port. So I tried just duplicating the initial connection (since it can't be edited directly in Workgroup Manager) and changing the hostname to the internal one, but I get an error when attempting to log in (the client login screen gives a very helpful "Couldn't login because of an error" error message) and don't see anything in the server logs.
    The client machine shows the following line:
    Code:
    10/20/12 5:27:42.688 PM authorizationhost: ERROR | -[HomeDirMounter mountNetworkHomeWithURL:attributes:dirPath:username:] |
         PremountHomeDirectoryWithAuthentication( url=afp://homes.services.internal/Users,
         homedir=/Network/Servers/homes.services.internal/Volumes/HomeDirectories/Users/ user123, name=user123 ) returned 45
    (added line breaks so it didn't extend off the page)
    So it looks like this is failing because the automount isn't in place, but I'm not sure how to work that out either (i.e. how do I add that making sure it uses the internal hostname?).
    Any suggestions on getting this to work?
    I realize one solution is just to LACP the two ports, but that is a different ball of wax (I may do that later if I get a 4 port ethernet card and performance limitations demand it).

    A possible solution might be this.
    On ADSLBOX and CABLEBOX configure different subnets for the LAN, e.g.
    ADSLBOX:    192.168.1.0/24
    CABLEBOX: 192.168.2.0/24
    The MEDIABOX gets these static IPs:
    ADSL-LAN: 192.168.1.2
    CABLE-LAN: 192.168.2.2
    On the MEDIABOX, configure the two network interfaces using two routing tables.
    The ADSL-LAN routing table
    ip route add 192.168.1.0/24 dev eth0 src 192.168.1.2 table 1
    ip route add default via 192.168.1.1 table 1
    The CABLE-LAN routing table
    ip route add 192.168.2.0/24 dev eth1 src 192.168.2.2 table 2
    ip route add default via 192.168.2.1 table 2
    The main routing table
    ip route add 192.168.1.0/24 dev eth0 src 192.168.1.2
    ip route add 192.168.2.0/24 dev eth1 src 192.168.2.2
    # use the CABLE-LAN gateway as default, so general internet traffic from MEDIABOX runs over CABLEBOX
    ip route add default via 192.168.2.1
    define the lookup rules
    ip rule add from 192.168.1.2 table 1
    ip rule add from 192.168.2.2 table 2
    To test the setup:
    ip route show
    ip route show table 1
    ip route show table 2
    I don't know how to persist something like this in ArchLinux using netctl. Might require to write a special systemd unit for it. Above is a working example from a RedHat box at my company.
    Last edited by teekay (2013-12-04 07:42:22)

  • I synced with iMac itunes and got many more contacts than I want on the iPhone. How can I delete multiple contacts rather than having to do so one at a time?

    I synced my iPhone with itunes and iMac and got many more contacts than I wanted on my iPhone. How can I delete quite a few of them at one time as opposed to deleting one at a time?

    iTunes does not handle the import of photos/videos from the iPhone's Camera Roll.
    If this is not the computer you sync your iPhone with, you should have been provided a warning message that your iPhone is associated with an iTunes library on another computer and when trying to transfer any iTunes content from a different computer, a warning message is provided indicating that all iTunes content on the iPhone will be erased first.
    When connecting an iPhone to iTunes on another computer, none of the options under the various tabs for the iPhone sync preferences with iTunes are selected automatically. This means you had to select Sync Contacts under the Info tab for your iPhone sync preferences with iTunes on your wife's computer.
    Assuming you are syncing contacts with a supported address book app on your computer, connect your iPhone to Tunes on your computer and without syncing, under the Info tab for your iPhone sync preferences below the Advanced section, select Contacts for replace info on this iPhone followed by a sync.
    For importing photos/videos from the Camera Roll which can be done with a computer that is not used for syncing the iPhone since syncing with iTunes is not involved.
    http://support.apple.com/kb/HT4083

  • Help!! Cant send email how change my outgoing smtp port to 587 stuck on 25

    Im on OSX 10.1.4. I go to Mail, Preferences, Account, Select my email account, Select Edit, Select Account Options.
    All I see is a box saying Connect to server port: and it says 143.
    When I try to send mail a message says smpt port timed our port 25. I called my internet provider and they told me to change my outgoing port to 587 but I cant find where to change the 25 to 587.
    If I go back to the above and change the 143 to 587 my incoming mail stops working.
    Am I looking in the wrong place or did I setup my email incorrectly? I selected mac account, pop, smtp.mac.com outgoing server, mail.mac.com for incoming server...did I do something wrong. I have a mac mail email address.
    Please someone help me!!
    Thanks.

    So there's no way to send with other ports? You HAVE to use port 25?
    Sure there is - talk to every mail administrator of every domain you might ever want to send mail to and have them reconfigure their mail servers to listen on some arbitrary port number that you define. Wait for them to do it (it shouldn't take them too long), and then you're done.
    Oh, no, hang on a minute... none of them are going to do that, are they?
    But that's what you're asking for - you're asking for them to accept mail on some non-standard port number just so you can get around Verizon's mail blocking.
    There is a reason why standard port numbers (defined by IANA) exists - just so that everyone's talking on the same page (or at least in the same chapter of the same book). You can't arbitrarily pick a port number and expect it to work unless both sides of the connection know to use it. You know port 25 works for SMTP because that's the standard. You can use any port number you like for your own mail because you can configure your own mail client to use a non-standard port, but you can't convince the rest of the world to follow suit (at least not without good reason).
    In this case your options are to relay your mail through Verizon's servers, upgrade to their business plan (which supports hosting your own mail server and doesn't break the user agreement), or setup another mail server somewhere else that you can relay your mail through.

Maybe you are looking for

  • Problem wih analysis authorization for two scenarios on same data provider

    Dear all, I am looking for a solution on the following authorization scenario (using the new analysis authorization). Unfortunately everything that I tried did not work out as expected: User A is allowed to manually access query 1 (based on cube A) w

  • Kernel Panic in iTunes

    Hi, Folks! I have a 2008 Mac Pro, and just a few days, I started getting kernel panics in iTunes. This hasn't happened in any other applications. Here's a few patterns I've noticed: -the KP crash happens when I add folders of music (aka drag-and-drop

  • GETWA_NOT_ASSIGNED

    HI ALL,   When i am seeing the data in cube (0sd_c03) i got runtime error "GETWA_NOT_ASSIGNED". ShrtText     Field symbol has not yet been assigned. What happened?     Error in ABAP application program.     The current ABAP program "SAPLRSDQ" had to

  • Connecting Mac Pro to Dual G5

    I apologize if this question has been asked before, but I could not find it. I have a new Mac Pro that I want to connect to my old, dual G5 via ethernet. What I'd like to be able to do is connect the Mac Pro (with a keyboard and monitor) to the G5 (w

  • Redo / Archive Log Best Practices?

    I am a newb when it comes to Oracle administration. The problem is that our "DBA" knows even less about it. I'd like to get some advice/recommendations on redo and archive logs. We are currently running: Windows 2000 Server Oracle 8.1.7 Oracle DB is