Before the client sends a new email, he/she specifies one or more (To) destination addresses. Is there any way to check the validity of these emails before sending the message ?
Define "validity".
This JavaMail FAQ entry might help.
The InternetAddress class only checks the syntax of the address. The InternetAddress class is not able to determine whether the address actually exists as a legal address. It is not even possible to verify the host name if the application is running behind a firewall or isn't currently connected to the Internet.
Related
I am trying to create a script in Python to transfer funds to another Coinbase user when all I have is an e-mail address. I have been unsuccessful so far. How do I get another user's "id" when all I have is their e-mail address?
As a follow on, can I add a memo/note to the transfer? If so, how?
Finally figured it out with a little bit more searching and trial and error. For anyone else who may have this question:
First get the account ID for the currency you want to send.
account_list = client.get_accounts()['data']
ETH_id = [acc['id'] for acc in account_list if acc['balance']['currency'] == "ETH"][0]
Then use the send_money function (not transfer_money) to send to an e-mail address.
client.send_money(ETH_id,to="<e-mail address>", amount="0.0005", currency="ETH", description = "Hey look, it worked.")
The description keyword is for the memo.
Is there any easy way to configure smtp for episerver forms? (iam using 4.0)
I want the form owner and potentially the user to get a confirmation mail.
Update
I tried to add a smtp settings in web.config
<mailSettings>
<smtp deliveryMethod="Network">
<network defaultCredentials="false" enableSsl="true" host="smtp.gmail.com" port="587" userName="***" password="***" />
</smtp>
</mailSettings>
</system.net>
And in episerver the form is configured:
I dont know if it should work, but i decided to read the logs and its complaining:
System.FormatException: The specified string is not in the form required for an e-mail address.
at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index)
at System.Net.Mail.MailAddressParser.ParseAddress(String data)
at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
at EPiServer.Forms.Implementation.Actors.SendEmailAfterSubmissionActor.SendMessage(EmailTemplateActorModel emailConfig)
However, its really hard to guess which string its complaining about since all ive done seems right to me. Any ideas?
Ok, so it works. I dont know why i thought i could enter whatever i wanted at the "from" address. Make sure its a correct email address and it works just fine.
If you want an email address from a form field you can select it by its name like this.
When sending emails via javamail, the following is always appended to the bottom of each message:
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager. This message contains confidential information and
is intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system. If you
are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.
How does one prevent this?
(NOTE: This problem is extremely frustrating to research on the web due to the fact that a disclaimer of this form is attached to so many indexed documents! :-(
JavaMail is not doing that, it is your outgoing SMTP server appending it to each message, probably set up by IT.
To confirm, you can use gmail's servers (with a personal account) and you will see it does not get added to the messages.
This should work. Pay attention to the form in which email body get parsed. In my case the emailBody string is on one line, so you have to put the "#Your disclaimer Here#" on one line. Answer for who will come in future.
public String deleteDisclaimer(String emailBody) {
String disclaimer = "#Your disclaimer here#";
if (emailBody.contains(disclaimer)) {
System.out.println("Deleting Disclaimer..");
return emailBody.substring(0,emailBody.indexOf(disclaimer));
}
System.out.println("DISCLAIMER NOT FOUND!");
return emailBody;
}
Is it possible to change the recipient address when using the reply function in Google Apps Script?
I want to receive an email from a random email account, mark it with a label and when scheduled, run the following code to reply to a desired email address rather than the original sender. The reason I want to reply is to keep it in the same thread. I have tried nearly all variations of the following code and can't get it to work the way I want it to:
thread.reply("This is a message.", {
htmlBody: "This is a message.",
name: "My Name",
recipient: "DESIRED#EMAIL.com",
replyTo: "DESIRED#EMAIL.com",
to: "DESIRED#EMAIL.com"
});
If you're asking to generate a random email address and send a real email from that address... that's not possible.
However... you could set the replyTo optional parameter as a random address - though when users would try to reply to that thread they would get a bounce-back notification that the address could not be reached. However, the original sender (the non-random address) would still be visible in the original message.
If you look at the GmailApp docs (replying)/(sending), you'll notice a few limitations. The sender's address (from) must be a valid Alias, if you're sending mail from MailApp (Google Apps Script).
However, there are plenty of methods in the GmailMessage class such as getFrom() and getReplyTo() that would allow you to get/set the message's from/replyTo parameters and have them be the same value. That way, when you reply to a message you will always be in the same thread.
i use the php framework cakePHP to create a web app. There,i want the user to insert in a field as many email addresses as he desires and by hitting the Send button,a message would be emailed to all of the emails.
To achieve that,i have to use bcc.
My problem is that i do not know how can i "read" from the user his email addresses in the right form so that i use them in bcc.
Till now,i have a variable $to = $this->request->data['Mail']['to']; ,where 'Mail' is my model name,and in case the user inserts just one email address,the recipient receives the mail correctly. But how can i enable it to receive multiple email addresses (maybe in an array??) so that i use the variable $to at this piece of code:
$Email = new CakeEmail();
$Email->from($from)
->**bcc($to)**
->subject($subject)
->send($message);
and help is welcomed :)
thank you in advance!
There is the API ( http://api.cakephp.org/2.3/class-CakeEmail.html#_addBcc ) and the code is open source. They all provide the information you are looking for.
If you open the class CakeEmail you will find ( https://github.com/cakephp/cakephp/blob/master/lib/Cake/Network/Email/CakeEmail.php#L482 ):
public function addBcc()
which is different from bcc() since it can be used multiple times to add multiple bcc addresses.