Smtp server password

I have download de java mail example from sun, and I tryed to send a mail with a picture. But I couldn't send the mail. I recived a mail that say that the smtp server did not reach the recipient(s).
One thing I want to ask is: Don't I need to put the password of the smtp server? If yes, where?
And the other question is: What could be the reason of this failure?
Thanks

OK, but the problem is that I'm trying to run a program that I have download, and it seems that it doesn't use the function that you mention to connect the smtp server. Perhaps you could tell me how can I modify this program to put the pasword. Thanks.
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
* sendfile will create a multipart message with the second
* block of the message being the given file.<p>
* This demonstrates how to use the FileDataSource to send
* a file via mail.<p>
* usage: <code>java sendfile <i>to from smtp file true|false</i></code>
* where <i>to</i> and <i>from</i> are the destination and
* origin email addresses, respectively, and <i>smtp</i>
* is the hostname of the machine that has smtp server
* running. <i>file</i> is the file to send. The next parameter
* either turns on or turns off debugging during sending.
* @author     Christopher Cotton
public class sendfile {
public static void main(String[] args) {
     if (args.length != 5) {
     System.out.println("usage: java sendfile <to> <from> <smtp> <file> true|false");
     System.exit(1);
     String to = args[0];
     String from = args[1];
     String host = args[2];
     String filename = args[3];
     boolean debug = Boolean.valueOf(args[4]).booleanValue();
     String msgText1 = "Sending a file.\n";
     String subject = "Sending a file";
     // create some properties and get the default Session
     Properties props = System.getProperties();
     props.put("mail.smtp.host", host);
     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(to)};
     msg.setRecipients(Message.RecipientType.TO, address);
     msg.setSubject(subject);
     // create and fill the first message part
     MimeBodyPart mbp1 = new MimeBodyPart();
     mbp1.setText(msgText1);
     // create the second message part
     MimeBodyPart mbp2 = new MimeBodyPart();
// attach the file to the message
     FileDataSource fds = new FileDataSource(filename);
     mbp2.setDataHandler(new DataHandler(fds));
     mbp2.setFileName(fds.getName());
     // create the Multipart and its parts to it
     Multipart mp = new MimeMultipart();
     mp.addBodyPart(mbp1);
     mp.addBodyPart(mbp2);
     // add the Multipart to the message
     msg.setContent(mp);
     // set the Date: header
     msg.setSentDate(new Date());
     // send the message
     Transport.send(msg);
     } catch (MessagingException mex) {
     mex.printStackTrace();
     Exception ex = null;
     if ((ex = mex.getNextException()) != null) {
          ex.printStackTrace();
}

Similar Messages

  • How do i change my smtp server password

    I have been getting messages saying that my connection was refused by the smtp server. The help screens said to delete the smtp server password and I now cannot find an option to replace it

    If there is no password you will be asked for it when it is needed.

  • HT201250 Will the Time Machine restore lost SMTP server password?

    Lost SMTP password.... will using time machine reset old password and allow me to use email server again? 
    I can backup all new files on ext. drives

    It won't.  Time Machine doesn't interact with the EFI hardware (the successor to the BIOS, if that helps), which is where Firmware Passwords are set up.
    HTH.

  • I changed my password on my aol account but it did not change on the SMTP server which is preventing me from answering email.  Help

    I changed my aol password but the SMTP server password did not change so I can't send mail.  How can I change the SMTP password?

    Go into Settings > Mail, Contacts, Calendars and select the account, then tap the account on the popup that you should get, and then tap on the SMTP server name

  • TS3899 how do i change the password on my primary smtp server

    i had to change my email password,
    now my primary smtp server password needs changed.
    I can read it but not change it or edit it.
    how do I change my primary smtp server password

    Delete the account and add it back.

  • How do I connect to an SMTP server that requires a username and password?

    Hi,
    I am currently working on a project for university which requires me to send and receive email. I was until this week able to send mail no problem, but now the SMTP server has been upgraded so that each time a mail is sent it requires the username and password.
    Ideally the connection should be made using TLS/SSL, and not use the Authenticator method. I want to pass the username and password directly if possible.
    I've been trying to use the following but have been getting handshake, and other exceptions:
    SMTPSSLTransport smtpSSLtransport = new SMTPSSLTransport(session,
                        new URLName("smtp", smtpHost, port, null-File,
                        "USERNAME", "PASSWORD"));
            smtpSSLtransport.setStartTLS(true);
            smtpSSLtransport.connect(new Socket(smtpHost, port));
            smtpSSLtransport.sendMessage(smtpMessage,                                                     message.getAllRecipients());
            smtpSSLtransport.close();Can anyone correct this piece of code for me or point me in the right direction of what classes and methods I should be using?
    Many thanks in advance,
    Gordon

    I always wonder what misleads people to do things this way.
    Was there some example you saw that suggested that instantiating
    an SMTPSSLTransport was the correct approach? I hope not.
    See the smtpsend.java demo program for how to use SMTP
    authentication. If you need to use SSL, see the SSLNOTES.txt
    file for hints on using the "smtps" protocol. smtpsend.java also
    illustrates use of SSL, but you'll need to fix a bug in it to use the
    correct property names ("mail.smtps.auth", etc.).

  • Can not specify the SMTP server port, username and password for my SharePoint 2013 web application

    We have our SMTP server under port number 141 and we should add username and password. but inside SharePoint 2013, I can only define the SMTP server name , from email, reply-to . But there are not fields to define the port number , the username and password.
    So can anyone advice from where I can define the port number and other field settings for the SMTP server ?
    Thanks

    i am no sure about user name and password. i never saw that option.
    check this guide:
    http://blogs.technet.com/b/tirumals/archive/2012/03/17/step-by-step-configuration-of-outgoing-emails-from-sharepoint-to-microsoft-online.aspx
    http://blog.fpweb.net/configuring-an-smtp-server-for-sharepoint/#.UuANoxAo6M8
    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
    thanks for the reply, but in our case the SMTP is  a separate server , and to connect to it i need to define the ; server IP /Name , port number, username & password. but in SharePoint there is no option to define the port number , and the links you
    provide are regarding configuring SMTP server, while we already have an SMTP server but i need to connect SP with it . can you advice please?

  • I am not able to send mails through Yahoo APP.It gives me an error msg :"the sender address has ben rejected by the server ".I tried adding username and password in the SMTP server settings,But those optiopns are greyed out.

    I am not able to send mails through Yahoo APP. It gives me an error msg :"the sender address has ben rejected by the server ".
    I tried adding username and password in the SMTP server settings,But those optiopns are greyed out.
    So, i am not able to enter anything in fields under SMTP server settings

    You probably have changing settings disabled in Restrictions.

  • TS3276 Hi there I am having trouble with my outlook express this is the first time it has happened it keeps telling me can't connect to the SMTP server and every password I have tried is incorrect this is for 'iCloud' very frustrating as all our phones ar

    Hi there I am having trouble with my outlook express this is the first time it has happened it keeps telling me can't connect to the SMTP server and every password I have tried is incorrect this is for 'iCloud' very frustrating as all our phones are ok

    Well I am feeling a bit silly now because that was all I had to do. In the past Workgroup Manager had always opened right up to the list of my users, I never even thought to click on that but apparently that was all that was needed.
    I still am not sure how the iChat Server preferences changed themselves on me, but it is not the first time I have had weird "settings" issues with our Snow Leopard Server.
    Thanks!

  • Can't send mail, get message: the smtp server rejected the password. I tried lock and unlock keychain. I tried unlock captcha. Gmail works okay, it is Mail that does not. Help!! :(

    Can't send mail, get message: the smtp server rejected the password. I tried lock and unlock keychain. I tried unlock captcha. Gmail works okay, it is Mail that does not. Help!!

    Hi
    You need to check with your ISP whether or not the send mail server (SMTP) requires a password.  Some do, but many do not.  When you know the correct password to send mail, then you need to tell Mail as follows:
    Mail menu > Preferences > Accounts > Select the account
    Click on the Outgoing Mail Server (SMTP) combo box, and select Edit SMTP Server List...
    In the Account Information tab put the server name
    In the Advanced Tab, set up the authentication information from your ISP.
    Good luck
    Bob

  • HP 8500 PLUS-scan to email - "SMTP server want approval- control SAMTP username and password"

    I have this brand new PRO 8500 PLUS machine, and everything is working except for the "scan to email" function.
    I did the setup in the web interface, in which I configured my GMAIL account to be the outgoing account in the printer.
    In the end I pressed "save and test" and it reported OK! I used my full GMAIL adress as SMTP username, and my GMAIL password as password.
    However, when I scan a paper and try send it to myself (same adress as confgured as outgoing in printer) it says something like(bad translation...)
     "SMTP server demands approval - check that SAMTP username and password is set" 
    Network config is:
    IP adress: 192.168.0.183
    Subnett mask: 255.255.255.0
    Standard gateway: 192.168.0.1
    DHCP
    Primary DNS server: 192.168.0.1
    Secundary DNS server: 0.0.0.0
    Printer is connected wirelessly to a DLINK DIR 655 .
    This question was solved.
    View Solution.

    Hey Cartman9090,
    Alright i did a little bit of researching and this is what i was able to come up with. There are two separate settings that perform two different actions.
    1. Under settings in the printer EWS you have email servers and individual settings for alerts. The email server settings under setting in the ews allow you to set up the product to send problem and status alerts to anyone through e-mail messages. When this function is configured, alerts are automatically triggered about supplies, paper-path status, and other service and advisory information.
    2. Under scan when configuring the scan to email in the EWS this is for configuring the e-mail address which will appear in the FROM portion of the e-mail message sent by the printer. The device allows you to scan documents and send them to one or more e-mail addresses as attachments—without additional scanning software. You do not need to scan files from your computer and attach them to e-mail messages. In addition to send scanned files as emails the device must use a outgoing email profile configured with an outgoing email account.
    **Click the KUDOS star on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.
    (Although I am employed by HP, I am speaking for myself and not for HP)

  • TS3899 Smtp server does not support password,what do I do now?

    Smtp server does not support password,what do I do now?

    What mail provider are yo using? I have not heard of one that does not use a password.

  • Mail SMTP server not accepting password. Works on all other clients.

    I am having issues with Mail and sending emails. Firstly I would like to say I have set this account up on Outlook 2011, Thunderbird and also Outlook PC and I can send and recieve with no problems.
    On Mac mail I can recieve emails perfectly.
    The account is set up with an SMTP Server. Our server requires authentication therefore I supply my username and password in there too. When I try to send an email mail says the server has rejected the password and asks for the correct password. The password I put in is correct, as it is the same password I have used on the other clients.
    So there is something that Mail doesnt like when it comes this server and I cant work out what it is.
    The only thing I thought of is that my password is all numbers. Could that make a difference?
    Any ideas?

    andrewrob,
    I had the same problem and found that I had to unlock CAPTCHA here: http://www.google.com/  accounts/DisplayUnlockCaptcha.
    This worked for me. If that doesn't work, you could try this:
    1. Open Keychain Access (located inside the Utilities folder which is inside the Applications folder)
    2. Highlight the login keychain in the white box to the left.
    3. Click the lock above it to lock the login keychain.
    4. Now unlock it.
    5. Go back to Mail and enter your password again. You will probably have to do it once for incoming mail and once for outgoing mail.
    I hope this helps!

  • Apple mail losing password for smtp server

    Macbook Pro 2.6ghz intel core 2 due 4 gb 667mhz ddr2 sdram OS X 10.5.7
    sbcglobal is mail server they are att.
    Must use password to retrieve and send email.
    Losing password for smtp server.
    Is it keychain or what?
    keychain is a PITB.
    thanks.

    Hi Linda,
    Launch the Mail application. Then from the Mail Menu Bar, click Mail/Preferences. Select the Accounts tab and then click the Account Information tab. Where you see: Incoming Mail Server ... make sure you password is available. It will be encrypted so all you will see are dots. If the field is empty, type in your password and close the Preferences window. The next time you send Mail, it might ask for the password but only to add to your Keychain. It shouldn't ask for it again.
    Hopefully that will do the trick...
    Carolyn

  • SMTP server is  rejecting my password in Mail

    We have a .Mac account with 4 email addresses on it. For some reason my wife's account works on the .Mac web page fine, but not on the Mac mail app.
    She can get mail but when she tries to send, we keep getting a "the smtp server rejected the password for email.mac.com account"
    I've checked her account settings against mine (which works fine) and I can't find a difference.
    thanks in advance for the help!

    I may not be using the right password...never had to enter one to use me.com, but every now and then I would get asked for a password and I would just hit cancel and mail would work fine.

Maybe you are looking for

  • Business System  and Business Service

    Hi,     A lot of confusion in this situation .When we will go for a  Business System.. and When we will  choose Business Service...we are using some SAP systems  only.. even though we are configuring those as a business services... can any one clarri

  • How to get Hotmail on iPhone

    I want to know how can I get hotmail on my iphone

  • Discoverer viewer in portal or Drill to detail in Disco report in Portal

    Hi Is it possible to embed discoverer viewer into Portal page. I know one way, I can achieve this in older versions by using <IFRAME src="worksheet url"></iframe> as HTML portlet. But, the problem here is that, our Discoverer viewer is SSO protected.

  • Using gradients with the gradient mesh tool

    So I have a basic knowledge of using the gradient mesh tool, but in my current project I need the gradients within the object to fade from black to transparent (it will be used for a one-color tshirt).  I've tried to do this a couple different ways. 

  • Firefox drops letters when using Franklin Gothic webfont, but not Safari

    I have bought the web version of Franklin Gothic Book, Medium and Demi from MyFont - and started to use these in my new site in development. We have hit a few problems which has caused me to have to reconsider the whole issue - unless help us at hand