Hi,
I have created on feed back from to send a mail .
I used by gmail id to recieve a mail .
but it wont work bcause in both the field of gmail i.e. From and To I m geting my email id.
here is the code that I have used.
public void postMail() throws MessagingException
{
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", "
imap.gmail.com");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.port", "993");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress[] addressTo = new InternetAddress[2];
/*for (int i = 0; i < recipients.length; i++)
{
addressTo[i] = new InternetAddress(recipients[i]);
}*/
addressTo[0] = new InternetAddress("
sandeep....@gmail.com");
addressTo[1] = new InternetAddress(email);
msg.setRecipients(
Message.RecipientType.TO, addressTo);
message = "Hello.......";
// Setting the Subject and Content Type
msg.setSubject("Thanks For feed Back");
msg.setContent("Test Mail ", "text/plain");
msg.setFrom(new InternetAddress(email));
Transport.send(msg);
System.out.println(addressTo[0]+"Mail Sent successfully...11");
}
And one Inner Class
private class SMTPAuthenticator extends javax.mail.Authenticator
{
public PasswordAuthentication getPasswordAuthentication()
{
String username = "
sandeep....@gmail.com";
String password = "XXXXXX";
return new PasswordAuthentication(username, password);
}
}
}
Thanks & Regards
Sandeep Sontakke.
'
On Thu, Jan 21, 2010 at 3:35 PM, Kiran Gawde
<gawde...@gmail.com> wrote:
Hi Sreehari,
Test Driven Developement is a defineltly a good way for
executing projects.
But i think if you have a reasonable good team of dedicated testing
team then the writing the test cases and the development goes on
parallel. Brainstorming sessions do happen initially with the entire
team before the test cases are written or the development team starts
writing the Program specs so that there is a clear understanding of
the requirement.
The Test cases are reviewed so that they are meeting the requirements.
When developemnt team gives the release the test cases are
executed.
So writing test cases and then starting the developemnt is not a
feasible task.
Regards,
Kiran
On Jan 3, 7:12 am, javatechnicals <javatec...@googlegroups.com>
wrote:
> What is Test Driven Development?
> This is question asked by one of my friend. Here i am writing my
> answer for that. Test Driven Development means writing Test Cases
> first and then developing code. This is best way to achieve a test
> suit. Its time consuming process, but in my open source project and my
> personal recomendation is to follow Test Driven Development. There are
> lots of reason i have found for that from the opensource project i
> have written and i am writing now.
>
> i). Any time you can change the internal structure of the project
> without changing the functionality. Your test cases makes sure that
> your chages is right or wrong.
>
> ii). Writing test cases will makes you to break down the code
> according to functionality. and ensures that that part is tested
> succesfully
>
> iii). If a new person, who knows the project partially can add/change
> the code[no need to worry about wether its effect to other part of
> project]
>
> iv). Doing TDD we can tell exact persentage of project status.
>
> Some disadvantages are:
>
> i). its boring task, not a creative work
>
> ii) time consuming while following a faster schedule.
>
> iii). Developer must have a good understanding on the automated
> testing API[JUnit or TestNG,..]
>
> This all are my understandings that i got from books my experiance.
> please reply your comments on this