Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <asp:SqlDataSource ID="userCourse" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>' SelectCommand="SELECT DISTINCT tblCourse.courseTitle, tblCourse.advisorOfStudiesID, tblPersonalInfo.firstName, tblPersonalInfo.lastName, tblPersonalInfo.email FROM tblCourse INNER JOIN tblAdvisorOfStudies ON tblCourse.advisorOfStudiesID = tblAdvisorOfStudies.advisorOfStudiesID INNER JOIN tblUsers ON tblAdvisorOfStudies.userID = tblUsers.userID INNER JOIN tblPersonalInfo ON tblUsers.personalInfoID = tblPersonalInfo.personalInfoID WHERE (tblCourse.courseID = @userID)">
- <SelectParameters>
- <asp:SessionParameter SessionField="userID" Name="userID"></asp:SessionParameter>
- </SelectParameters>
- </asp:SqlDataSource>
- <asp:ListView ID="ListView1" runat="server" DataSourceID="userCourse">
- <ItemTemplate>
- <asp:Label ID="aosemail" runat="server" Text='<%# Eval("email") %>' />
- <asp:Label ID="aosname" hidden runat="server" Text='<%# Eval("firstName") %>' />
- </ItemTemplate>
- </asp:ListView>
- private bool SendEmail()
- {
- string recipient = aosemail; //AOS Email textbox should go here
- MailMessage mm = new MailMessage("CSC3047@gmail.com", recipient);
- mm.Subject = "Student has chosen Manual Enrollment Process!";
- //AOS name textbox will be here
- mm.Body = "Hi " + aosename+ "<br><br>This is a quick email to inform you that " + Name.Text.ToString() + " has chosen the manual enrollment process. The reason we are emailing you is that you are their Advisor of Studies. Please email the user on " + Email.Text.ToString() + " <br><br>Regards";
- mm.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "smtp.gmail.com";
- smtp.EnableSsl = true;
- NetworkCredential NetworkCred = new NetworkCredential();
- NetworkCred.UserName = "*************";
- NetworkCred.Password = "*********";
- smtp.UseDefaultCredentials = true;
- smtp.Credentials = NetworkCred;
- smtp.Port = 587;
- smtp.Send(mm);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement