guys i had created a web site on my own where people have to register to use the site.When the user rgisters in site an e-mail is sent to his e-mail account for the verication, Its working fine on my local machine but i am unable to send it from my server.
after the user is registred i am sending e-mail like this:
da.SubmitChanges();
Guid userId = (Guid)Membership.GetUser(_username.Text).ProviderUserKey;
mj.bal.business_rules sender = new mj.bal.business_rules();
sender.GmailEmailSender(_emailid.Text, GetMessage(), "Welcome to Student Site");
return true;
//mj.bal.business_rules(); is my class file where e-mail crediantials are saved..
Yes i am getting no messages but no email also, after registration the user getting successfully redirected to "SUC_REG.ASPX" page.But withouth the email.
Jay61
Member
123 Points
93 Posts
Unable to send verifcation e-mail
Jul 29, 2012 11:31 AM|LINK
Hi,
guys i had created a web site on my own where people have to register to use the site.When the user rgisters in site an e-mail is sent to his e-mail account for the verication, Its working fine on my local machine but i am unable to send it from my server.
here is the code.. (register page)
private Boolean CreateMembershipUser() { MembershipCreateStatus status; user = Membership.CreateUser(this._username.Text, this._pass.Text, this._emailid.Text, "NoWayOutNow", "12346677", false, out status); if (user == null) { this._msg.Text = GetErrorMessage(status); return false; } else { Roles.AddUserToRole(this._username.Text, "Registered"); return true; } }after the user is registred i am sending e-mail like this:
da.SubmitChanges(); Guid userId = (Guid)Membership.GetUser(_username.Text).ProviderUserKey; mj.bal.business_rules sender = new mj.bal.business_rules(); sender.GmailEmailSender(_emailid.Text, GetMessage(), "Welcome to Student Site"); return true; //mj.bal.business_rules(); is my class file where e-mail crediantials are saved..nirman.doshi
Participant
1520 Points
775 Posts
Re: Unable to send verifcation e-mail
Jul 29, 2012 11:34 AM|LINK
What is the error you are receiving?
Software Developer
Vadodara, India
Jay61
Member
123 Points
93 Posts
Re: Unable to send verifcation e-mail
Jul 29, 2012 11:46 AM|LINK
No error message but the activation email is not getting received by the user.
Jay61
Member
123 Points
93 Posts
Re: Unable to send verifcation e-mail
Jul 29, 2012 11:50 AM|LINK
public Boolean GmailEmailSender(string _to, string message, string _subject) { try { MailMessage mail = new MailMessage(); MailAddress from = new MailAddress("studentsitehelp@gmail.com"); mail.From = from; mail.To.Add(_to); mail.Subject = _subject; mail.Body = message; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("studentsitehelp@gmail.com", "##my password##"); smtp.EnableSsl = true; smtp.Send(mail); return true; } catch { return false; }nirman.doshi
Participant
1520 Points
775 Posts
Re: Unable to send verifcation e-mail
Jul 29, 2012 12:17 PM|LINK
Seems, there is no issue with your code.
This works fine both in local and IIS at my end.
Probably there may be some security issues, or IIS/ Firewall configurations at your end.
To get the exact problem, try out putting an Exception in catch block, and print the message for quick idea.
something like -
catch (Exception ex) { lblResult.Text = ex.Message; if (ex.InnerException != null) { lblResult.Text = lblResult.Text + " " + ex.InnerException.Message; } return false; }Software Developer
Vadodara, India
Jay61
Member
123 Points
93 Posts
Re: Unable to send verifcation e-mail
Jul 29, 2012 12:19 PM|LINK
Jay61
Member
123 Points
93 Posts
Re: Unable to send verifcation e-mail
Jul 29, 2012 01:54 PM|LINK
No bro its also not working..
nirman.doshi
Participant
1520 Points
775 Posts
Re: Unable to send verifcation e-mail
Jul 30, 2012 04:29 AM|LINK
You mean to say you are not getting any exception message?
Software Developer
Vadodara, India
Jay61
Member
123 Points
93 Posts
Re: Unable to send verifcation e-mail
Jul 30, 2012 04:50 AM|LINK
Yes i am getting no messages but no email also, after registration the user getting successfully redirected to "SUC_REG.ASPX" page.But withouth the email.
nirman.doshi
Participant
1520 Points
775 Posts
Re: Unable to send verifcation e-mail
Jul 30, 2012 05:39 AM|LINK
That's quite strange!
Looked into sent items/ Drafts folder of the sender email account?
Software Developer
Vadodara, India