×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Email question: Unable to send mail to mymailid@yahoo.com

Email question: Unable to send mail to mymailid@yahoo.com

Email question: Unable to send mail to mymailid@yahoo.com

(OP)
Hi all,

I am able to send mail to my office account but when I try to send it to out side i.e my yahoo id, I am unable to receive the mail . It does not give any error message also..

CODE

            Email email = new Email();
            email.setContent("Test Email");
            email.setReceipient(user.getUserID());
            email.setReceipientEmail("myID@yahoo.com");
            email.setSubject("Test subject  " );
            email.setSentDate(new Date(System.currentTimeMillis()));
            
            try {
                EmailSender.sendEmail(email);
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (MessagingException e) {
                e.printStackTrace();
            }

and here is the email sender.

CODE

    public static void sendEmail( Email email ) throws MessagingException, UnsupportedEncodingException {    
        
        //String SYSTEM_EMAIL = SystemProperties.getProperty("system.emailAddress");
        //String SYSTEM_NAME = SystemProperties.getProperty("system.emailDisplay");
        String SYSTEM_EMAIL = "karthik@starry-associates.com";
        String SYSTEM_NAME = "starry-associates.com";
    
        boolean debug = false;
    
        //Set the host smtp address
        Properties props = new Properties();
        props.put("mail.transport.protocol", "smtp");

        /* props.put("mail.smtp.host", SystemProperties.getProperty("system.mailServer"));
           props.put("mail.host", SystemProperties.getProperty("system.mailServer"));      */

        props.put("mail.smtp.host", "mail01");
        props.put("mail.host", "mail01");
        log.debug(props.toString());        
        
        // create some properties and get the default Session
        Session session = Session.getDefaultInstance(props, null);
        session.setDebug(debug);
    
        // create a message
        MimeMessage msg = new MimeMessage(session);
    
        // set the from address and full name
        InternetAddress addrFrom = new InternetAddress(SYSTEM_EMAIL, SYSTEM_NAME);
        msg.setFrom(addrFrom);
        
        // set the replyTo address
        InternetAddress[] addrReplyTo = new InternetAddress[1];
        addrReplyTo[0] = new InternetAddress(SYSTEM_REPLY_TO);
        msg.setReplyTo(addrReplyTo);
    
        // set the TO address
        InternetAddress[] addrTo = new InternetAddress[1];
        addrTo[0] = new InternetAddress(email.getReceipientEmail());
        msg.setRecipients(Message.RecipientType.TO, addrTo);
    
        // Setting the Subject and Content Type
        msg.setSubject(email.getSubject());
        msg.setContent(email.getContent(), "text/html");        
        
        // setting the Flag or Priority
        if (email.isFlagged()) {
            Flags flags = new Flags();
            flags.add(Flag.FLAGGED);
            msg.setFlags(flags, true);
            msg.addHeader("Priority", "Urgent");
            msg.addHeader("Importance", "high");            
        }
    
        // properly set the sent date
        msg.setSentDate(new Date(System.currentTimeMillis()));

        log.debug("Sending email from "+email.getSender());

        //String mailServer = SystemProperties.getProperty("system.mailServer");
        //String account = SystemProperties.getProperty("system.mailAccount");
        //String passwd = SystemProperties.getProperty("system.mailPassword");

        String mailServer = "mail01";
        String account = "karthik";
        String passwd = "4321";
        if (passwd==null) passwd="";
    
        // using the non-static version so we can connect with a NULL password
        Transport transport = session.getTransport("smtp");
        transport.connect(mailServer, account, passwd);
        transport.sendMessage(msg, msg.getAllRecipients());
        transport.close();
    }


Thanks to all in advance..

RE: Email question: Unable to send mail to mymailid@yahoo.com

(OP)
I am sorry if this forum is not the right one..
I will post this is java forum..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close