Example #1
0
    protected void orderButton_Click(object sender, EventArgs e)
    {
        tripSqlDataSource.Insert();

        string senderName      = "YouTravel";
        string senderAddress   = "*****@*****.**";
        string receiverName    = userLabel.Text;
        string receiverAddress = Session["email"].ToString();
        string subject         = placeLabel.Text + " " + tripDateLabel.Text;
        string message         = receiverName + ":<br>銘謝惠顧!祝旅途愉快!<br>地圖資訊請參考。<br>" + senderName + "敬上<br>";

        string tripMap = string.Format("<img src='http://maps.googleapis.com/maps/api/staticmap?"
                                       + "center={0},{1}"
                                       + "&zoom=15"
                                       + "&size=360x240"
                                       + "&maptype=roadmap"
                                       + "&markers=color:red%7C{0},{1}"
                                       + "&sensor=false'/>", latitudeHiddenField.Value, longitudeHiddenField.Value);

        MailServiceReference.MailData mail = new MailServiceReference.MailData();
        mail.senderAddress   = senderAddress;
        mail.receiverAddress = receiverAddress;
        mail.subject         = subject;
        mail.message         = message + tripMap;

        MailServiceReference.MailServiceClient mailService = new MailServiceReference.MailServiceClient();
        mailService.sendMail(mail);

        Response.Redirect("tripList.aspx");
    }
Example #2
0
    protected void sendButton_Click(object sender, EventArgs e)
    {
        MailServiceReference.MailData mailData = new MailServiceReference.MailData();

        mailData.senderName      = senderNameTextBox.Text;
        mailData.senderAddress   = senderAddressTextBox.Text;
        mailData.receiverName    = receiverNameTextBox.Text;
        mailData.receiverAddress = receiverAddressTextBox.Text;
        mailData.subject         = subjectTextBox.Text;
        mailData.message         = receiverNameTextBox.Text + ":<br><br>" + messageTextBox.Text + "<br><br>" + senderNameTextBox.Text;
        MailServiceReference.MailServiceClient mailService = new MailServiceReference.MailServiceClient();

        mailService.sendMail(mailData);
        Response.Redirect("simpleMail.aspx");
    }