3

I am working on mail sending application. I have successfully integrated JavaMail API to work with Gmail account using gmail authentication. I want to know whether , this Api will work with other mail accounts too?

Lalit Poptani
  • 65,659
  • 21
  • 155
  • 238
mH16
  • 2,258
  • 4
  • 24
  • 35
  • yes of course..you r send mail with your gmail acccount to any mailaddress.. – Gensheriff Nov 24 '11 at 07:03
  • 1
    well thanks for ur reply. its already implemeted. I want to use different email id for Sender(From field). – mH16 Nov 24 '11 at 07:58
  • I saw that..but you must be use Gmail Sender because in java mail is not supported any other...you can also change receiver of anything email address..Thanx – Gensheriff Nov 24 '11 at 12:13

2 Answers2

3

The sender will be the gmail by default. to change the sender mail id account type to other such as yahoo or hotmail, you have to configure its settings such as port and smtp server name.

Pattabi Raman
  • 5,514
  • 10
  • 35
  • 59
  • thanks for your reply. Is there anyway to dyanmically change those setting depending on the From field email id provided by user? – mH16 Nov 24 '11 at 07:55
  • You can do that but you have to do the connection method to ask for username and pass and you could check the email type by checking the username suffix (eg. @yaho.com..) but the best approach is to ask the user to select the email type is using – Cata Nov 24 '11 at 08:19
2

You can use any SMTP server to send a message with JavaMail and any account on that servers. If you want to send a message with From field other than default for given server/account, it depends entirely on SMTP server that you use. Some of it could permit to set an arbitrary From field value, but most of it - not. Anyway it's not about JavaMail, it's about SMTP.

praetorian droid
  • 2,921
  • 1
  • 15
  • 18