I am using MailKit to reply to an email received from a Gmail account. I set the value of the In-Reply-To and References header as described in the MailKit documentation:
if (!string.IsNullOrEmpty(replyMessage.MessageId)) {
message.InReplyTo = replyMessage.MessageId;
foreach (var id in replyMessage.References) {
message.References.Add(id);
}
message.References.Add(replyMessage.MessageId);
}
Given this, I expect the reply mail to show up in Gmail as a reply to the original message. However, this does not happen. The mail is shown like any other random new mail.
Am I missing something?
You also need to set to message.Subject to “Re: “ + replyMessage.Subject
Related
I am using CI library to send an email using Sendgrid smtp.
but it is not giving any response, neither email is sending.
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.sendgrid.net';
$config['smtp_user'] = 'api key name';
$config['smtp_pass'] = 'api key';
$config['smtp_port'] = '587';
$config['smtp_keepalive'] = 'TRUE';
$this->email->initialize($config);
$this->email->from('test#test.com', FROM_NAME);
$this->email->to($email);
extract($arr_var);
$sub=addslashes($row['subject']);
eval("\$subject= \"$sub\";");
$body=addslashes($row['message']);
eval("\$message= \"$body\";");
if ($subject!='') {
$this->email->subject(stripslashes($subject));
} else {
$this->email->subject($row['subject'].' - '.$this->config->item('app_title'));
}
$this->email->message($message);
$bool=$this->email->send();
Using above code i am sending en email CI v3 but it I am not receiving any email?
Twilio SendGrid developer evangelist here.
Two things stand out to me here.
First, where you set the smtp username, it should be the string "apikey" (see the instructions for sending with SMTP here).
Second, the from address you are sending from is "test#test.com". SendGrid requires you to verify the identity you send from. You either need go through Single Sender Verification or Domain Authentication and then use an email address that you have verified to send the emails from.
Once you have sorted those two bits out, your emails should send successfully.
I retrieve eMails from a GMail account with a TIdIMAP4-object and want to forward them with TIdSMTP to an other (GMail-)account while preserving the original list of recipients.
My approach was adding the destination address as BCC to make it invisible in the destination, but how can I prevent the SMTP component from sending it to all the other recipients in the list? They then would get all the forwarded mails twice.
UPDATE 1:
Instead of using BCC I provided the destination address in the send statement
smtp.Send(msg,destination);
but the message is still sent to all the other recipients.
By default, TIdSMTP.Send() will send the email to all of the recipients listed in the Recipients, CcList and BccList properties of TIdMessage.
When you download an email into a TIdMessage via POP3 or IMAP, the Recipients and CcList (but not the BccList) are filled in from the email's existing To and CC headers, respectively.
When you then forward the email, if you do not want it to be sent to the recipients specified in the email, then you can call the overloaded version of TIdSMTP.Send() that takes a recipient list as a parameter. That will send the email ONLY to that list. For example:
var
forwardTo: TIdEmailAddressList;
begin
...
forwardTo := TIdEmailAddressList.Create;
try
// add desired recipients to forwardTo as needed, then...
smtp.Send(msg, forwardTo);
finally
forwardTo.Free;
end;
...
end;
we have a little problem with the design of the mail templates for the sender. If we insert an email address with the link email function, this will be shown in the mail the recipient gets without the "#" and the persistent points.
How can we change this? What are we doing wrong.
Thank you
This sounds like your email-address encryption fails. Especially the replacement of # and .. maybe the replacements contain tags or other special characters which gets removed in the process of email generation.
Make sure you remove the email-encryption for mail rendering.
Something like:
mail = PAGE
mail {
typeNum = 99
config {
spamProtectEmailAddresses = 0
spamProtectEmailAddresses_atSubst = #
spamProtectEmailAddresses_lastDotSubst = .
}
}
I am sending an email to alias#company.com which is an alias to a real mailbox address. I then connect to the real mailbox (let's say realmailbox#company.com) using MailKit and retrieve messages. When I inspect the To address, all I see is the realmailbox#company.com. How to I see the original alias address that the email was sent to?
For example:
var fullMessage = imapClient.Inbox.GetMessage(uid);
var recipients = fullMessage.To;
recipients only show the realmailbox#company.com, not the alias#company.com.
It sounds to me like your SMTP server is performing a string substitution on the alias before passing it along to the recipient mailbox making it impossible to get the info you are looking for.
I have a Google Apps spreadsheet that is filled by user-submitted forms. I'm trying to write a script that verifies that the Email field filled by the users is valid. I'm using MailApp to send a confirmation email and catching errors, like this:
try {
MailApp.sendEmail(address, subject, message, {'htmlBody':htmlMessage, 'noReply':true});
Logger.log("Sending email to " + address);
} catch(e) {
return "Failed: Invalid address";
}
This works fine for immediate errors (null or malformed addresses), but not for non-existing email addresses. To catch those, until now I used the following code to wait 5 seconds and then check the inbox for Mail Delivery Notification emails:
Utilities.sleep(5000);
var threads = GmailApp.search("is:unread subject:\"delivery status notification\" " + address);
if (threads.length > 0) {
return "Failed: Delivery failed. " + threads[0].getPermalink();
}
This worked fine last year when I used it last, but trying now, I don't get the mail delivery notifications messages anymore when sending mail via script - apparently Google changed something, and now only manually sent messages receive the notification.
So given that my previous method has stopped working, does anyone have any idea of an alternative, automated method to verify the emails work?