Is there anyway to get an email sent without putting the password into the code ?
There are many email api-s that enables to send an email with entering the username and password.
Example
sendEmail("myemail@gmail.com","mypass","subject","msg body");
Is there any way around the problem with hard-coding the password in code ?
You have three options to send email:
the application will send emails from this email address.
case you’ll receive a mail from user’s address.
fields and call user’s email client to send this.
If you want silent way to send email then you should choose 1 or 2. But more secure way is to use the third approach.