I have an html form having input fields to add a new user. Once a user is added to my database the mail is sent to her/him using the sendmail() function in my adduser.js file. The mail sent as per my standard.But the thing is i want to add a hyperlink in to the body content. My line is like this:
  sendMail(result.email, DbConfig.mailConfig.subject, "Dear" + " " + req.body.txtFirstName + req.body.txtLastName + ",\n Welcome to, COMPANY NAME " + txt.link('http://www.website.in') + "Your Login details are below: \n User name:" + req.body.txtLoginId + " \n Password:" + result.pwd)
But it is not working as i expected. The result in my mail is
Dear user.
Welcome to,COMPANY NAME<ahref="www.website.in"></a>.
It is coming like this.But the link redirects to a specified target. My expectation is:
Dear user.
Welcome to,COMPANY NAME.(on click of company name it redirects to targeted link).
How can i achieve this.I try to use directly tag in my JS. It also nt works properly in my case.
Thanks,
One way is emailjs on node. I have taken the liberty of pasting their example:
$ npm install emails;
//app.js:
var email   = require("./path/to/emailjs/email");
var server  = email.server.connect({
   user:    "username", 
   password:"password", 
   host:    "smtp.gmail.com", 
   ssl:     true
});
var message = {
   text:    "i hope this works", 
   from:    "you <username@gmail.com>", 
   to:      "someone <someone@gmail.com>, another <another@gmail.com>",
   cc:      "else <else@gmail.com>",
   subject: "testing emailjs",
   attachment: 
   [
      {data:"<html>i <i>hope</i> this works!</html>", alternative:true},
      {path:"path/to/file.zip", type:"application/zip", name:"renamed.zip"}
   ]
};
// send the message and get a callback with an error or details of the message that was sent
server.send(message, function(err, message) { console.log(err || message); });
// you can continue to send more messages with successive calls to 'server.send', 
// they will be queued on the same smtp connection
// or you can create a new server connection with 'email.server.connect' 
// to asynchronously send individual emails instead of a queue
				
			Assuming that the sendMail function is working correctly, you'll need to specify the "content type" of the email in the headers. I'm unfamiliar the particular function that you're using but PHP's 'mail' function is formatted similarly and takes a fourth parameter for additional headers.
I imagine it might work something like:
var headers = 'Content-type: text/html; charset=iso-8859-1' + "\r\n";
var message = "Dear" + " " + req.body.txtFirstName + req.body.txtLastName + ",\n Welcome to, COMPANY NAME " + txt.link('http://www.website.in') + "Your Login details are below: \n User name:" + req.body.txtLoginId + " \n Password:" + result.pwd;
sendMail(result.email, DbConfig.mailConfig.subject, message, headers)