Message after sending mail asp.net - email

string Emails = "";
foreach (GridViewRow gr in gvregview.Rows)
{
CheckBox chk = (CheckBox)gr.FindControl("Checked");
Label ID = (Label)gr.FindControl("lblEmail");
Label lbl = (Label)gr.FindControl("lblPass");
Label Lblmrno = (Label)gr.FindControl("Lblmrno");
if (chk.Checked == true)
{
SendMail(ID.Text, lbl.Text);
//lblmsg.Text = "Mail Sent to "+Lblmrno.Text;
Response.BufferOutput = true;
puposalda.MailSentResponse = Lblmrno.Text;
//Response.Write("Mail to sent to" + Lblmrno.Text);
System.Threading.Thread.Sleep(500);
}
}
Hi Everybody, i want to send mail to all selected users in gridview and display Message 'Mail sent to the user UserName' for each user. Mail is sent successfully but only last user name is displaying. How to do that. Response.write is working but it is displaying message on the top. But i want to display message at specific location.
Thanks
Thanks

lblmsg.Text += "Mail Sent to "+Lblmrno.Text+", ";
in that case you ADD the text, not replace it.

I want to replace text not append Text. When mail to the first user has been sent successfully. Then message should display on the page. then same for other users.

Related

How would i pull zend mail addresses from a table

I have a .php file that has a list of email addresses in zend_mail. When a user sends out an alert message, say a bus broke down, the alert goes to my database and everyone on the email list. I would like the email addresses to come from table rather than be hard coded into the php file
We are only hard coding right now, sometimes twenty addresses, for each php file
try {
$mail = new Zend_Mail();
$mail->addTo('johnnywalker#comcast.net');
$mail->addTo('mjimeez#thistransportation.com');
$mail->addTo('aburrow#thistransportation.com');
If the code were to say try{ from mytable which contains a list of addresses in column a,where column b = 1,representing which php files go to which employees
$sql = $dbRead->quoteInto("SELECT alertID,[alertDescription],count(*) as [Count] FROM dbo.ActiveAlerts WHERE subdomain = ? GROUP by alertID, [alertDescription]",$subdomain);
$resultAlerts = $dbRead->fetchAll($sql);
foreach($resultAlerts as $x){$alertIDs .= $x['alertID']."|";}; //load for controller
Then this adds it to the table
$alertID = "1001"; //incident updates
if(strstr($alertIDsOK,$alertID)) {
try {
$sql = $dbRead->quoteInto("SELECT email FROM dbo.ActiveAlerts WHERE alertID = ?",$alertID);
$resultEmail = $dbRead->fetchAll($sql);
$mail = new Zend_Mail();
foreach($resultEmail as $m){
$mail->addTo($m['email']);}

How can I program a group of conditional emails that are sent in order and one by one?

How can I program a group of conditional emails that are to supposed to be sent one by one, depending on the field of the form the user has selected and also by the order that the users fill it out?
Each user is supposed to get only one email, and the email should arrive in their inbox, and it's also is supposed to be displayed on their screen.
Form example:
Name
Email
Option a, Option b, Option c
Submit
I want to be able to send out 4 emails (or more) for Option a, 4 emails for Option b, 4 emails for Option c.
Example:
Option a - Email 1
Option a - Email 2
Option a - Email 3
Option a -Email 4
Let's say:
User 1 fills out the form and selects Option a, he is supposed to get only Option a - Email 1.
User 2 fills out the form and selects Option b, he is supposed to get only Option b - Email 1.
User 3 fills out the form and selects Option a, he is supposed to get only Option a - Email 2.
And so on...
What would be the easiest way to program this form and make a backend so the admin can just edit the emails and options?
$mail->From = 'from#example.com';
$mail->FromName = 'Mailer';
$mail->addAddress('joe#example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen#example.com'); // Name is optional
$mail->addReplyTo('info#example.com', 'Information');
$mail->addCC('cc#example.com');
$mail->addBCC('bcc#example.com');
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}

google script column change email notification

This is my first attempt at writing any kind of script, and also posting a question.
I have created a google sheet, and I would like to send an e-mail notification every time a row is added in this spreadsheet (or to keep things simple, every time a new cell is populated in column A).
I've been searching these forums for a couple of hours, and put together the following script, and tried installing both "onedit" & "onchange" triggers in google scripts but nothing working.
The following links have been helpful, but still not able to get the result I want. No notification is being triggered at all automatically upon the relevant edits.
how to attach onChange cell value event/script to google sheet
email notification if cell is changed
//Open function
function sendNotification() {
//Get spreadsheet & sheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
//Define notification details
var recipients = "myname#email.com";
var subject = "New lead";
var body = 'A new lead has been added to Simba. For message: ' + message + '';
//Specify several sheet variables
var cell = ss.getActiveCell().getA1Notation();
var row = sheet.getActiveRange().getRow();
var cellvalue = ss.getActiveCell().getValue().toString();
var message = '';
//Specify if statement
if(cell.indexOf('A')!=-1){
message = sheet.getRange('B'+ sheet.getActiveCell().getRowIndex()).getValue()
}
//Send the Email
MailApp.sendEmail(recipients, subject, body);
//Close function
};
var body = 'A new lead has been added to Simba. For message: ' + message + '';
At this line, "message" is undefined. It occurs an error. By this error, mail cannot be sent. Because the definition of "message" is below from this line. So please change this line to below
message = sheet.getRange('B'+ sheet.getActiveCell().getRowIndex()).getValue()
And please install a trigger for this function. The method of installing trigger is shown at your reference URL.

EWS: Find mail by EntryID/ItemID in sent items?

I have the EntryID and ItemID of a mail, how can I using EWS get the mail not knowing if it's in the "Inbox" or "Sent items"?
I've tried this..
Dim ewsID As String = "AAAAAMgC9AZo0nACt4jVCOhhCmcHAF35p973GUpBjIUVAx1CYigAAAAAABEAAF35p973GUpBjIUVAx1CYigAAiwdaBwAAA=="
Dim email As EmailMessage = EmailMessage.Bind(service, New Microsoft.Exchange.WebServices.Data.ItemId(ewsID))
But it doesn't find anything.
Help :)
If you have HexEntryId from PR_EntryId or from Outlook OOM app you need to use convertItem to convert to an EWSid to use eg based on what you posted this should work
String ItemId = "AAAAAMgC9AZo0nACt4jVCOhhCmcHAF35p973GUpBjIUVAx1CYigAAAAAABEAAF35p973GUpBjIUVAx1CYigAAiwdaBwAAA==";
AlternateId HexId = new AlternateId(IdFormat.HexEntryId, BitConverter.ToString(Convert.FromBase64String(ItemId)).Replace("-", ""), "Mailbo#domain.com");
AlternateIdBase Converted = service.ConvertId(HexId, IdFormat.EwsId);
EmailMessage Message = EmailMessage.Bind(service, new ItemId(((AlternateId)Converted).UniqueId));
Cheers
Glen

Send HTML email asp

I want to add some html in an email. I've tried the following.
vFromName = "someone"
vFromAddress = "someemail"
vTo = "recipient"
vSubject="someSubject"
vBodyofemail = "<html><table><tr><td><b>SomeText</b></td></tr></table></html>"
Call SendMail()
sub SendMail()
'change to address of your own SMTP server
strHost = "mail.internal.rouses.com"
Set Mail = Server.CreateObject("Persits.MailSender")
'enter valid SMTP host
Mail.Host = strHost
'From eMail address
Mail.FromName = vFromName
'From address
Mail.From = vFromAddress
'To eMail address
Mail.AddAddress vTo
'message subject
Mail.Subject = vSubject
'message body
Mail.Body = vBodyOfEmail
Mail.Send
end sub
How can i do this? I've tried Mail.HtmlBody but that doesn't work either. The email is sent but all i see are the tags where the html is.
According to this page you need to set the IsHTML flag to true.
strHTML = "Hello world"
Mail.IsHTML = True
Mail.Body = "<HTML><BODY><CENTER>" & strHTML & "</CENTER></BODY></HTML>"
Try adding this line above the send call.
Mail.IsHTML = true
Without it, the Mail object defaults to standard text and whatever is typed into the Body property will be rendered in the email as text.
Not an answer to your question, but shouldn't all messages include plain text as well? Without plain text, you'll surely get a higher spam score.
(And people like myself prefer to switch to plain text if your HTML/CSS is not rendered well. See Guide to CSS support in email clients (2008), and the list at the Email Standards Project.)