Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

How do i send mail with attachment and mail body will have some data

HiExperts,

How do i send mail with attachment and mail body will have some data

question1
answer1  
question2
answer2
feedback_comments
created_on

along with these fields one attachment(with some text content) i need to send.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srikotesh
srikotesh

ASKER

I will try this link
Hi CEHJ,

When i am trying with the above link i am getting authentication failed.

javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtk
I just tested it. Worked fine (of course after i'd put the correct addresses and username/password in)
Update: just changed (and tested) the code at that link so it's easier to use
still authentication failed.
this link helps me out of authentication failed.

http://stackoverflow.com/questions/25341198/javax-mail-authenticationfailedexception-is-thrown-while-sending-email-in-java

Now i am able to send mail successfully.
Hi CEHJ,

Thanks for your suggested link.

Now coming to my requirement.
For each user request
i have to create a file and insert  question , answers and feedback comments into that file.
can you help me on this..
For each user request
i have to create a file and insert  question , answers and feedback comments into that file.
Is it the same file for each user or is each different?
no file name should be unique.it should not be a duplicate
Hi Cehj,

This is the sample template i have to send it in attachment.
please find the attachment.
template.PNG
Looks like the kind of thing that would be more apt to do with a web form than an email.

Also looks like it needs quite a bit of proof-reading/editing ;)
Hi cehj,
that is a sample template.we no need to send exactly the same.the best possible way how we can send this attachment using java.
These are two separate issues:

a. populate a template with data to produce a mail file
b. attach a mail file to an email and send it

You posted a question about b. and i believe i've answered it
k
I will raise one more question for this
:)