I've set up my mailto links so that they open Gmail.
// you can code a url like this to push things into gmail
https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=user#example.com
I understand there are several other variables:
&su= // email subject
&body= // body text
&disablechatbrowsercheck=1 // pretty self explanatory
The thing is I can't find a list anywhere with the possible ones.
Has anyone composed such a thing or found such a list.
Edit: You can now resort to classic mailto links to pass subject and body params:
email here
why bother doing that ? the mailto link will open the default mail client you have installed
i think having gmail notifier installed is enough
and that will be better to users with no gmail.
see here Making Gmail your default mail application or this Make mailto: links open in gmail
if not i found this example from here:
https://mail.google.com/mail?view=cm&tf=0" +
(emailTo ? ("&to=" + emailTo) : "") +
(emailCC ? ("&cc=" + emailCC) : "") +
(emailSubject ? ("&su=" + emailSubject) : "") +
(emailBody ? ("&body=" + emailBody) : "");
The example URLs for standard gmail, above, return a google error.
The February 2014 post to thread 2583928 recommends replacing view=cm&fs=1&tf=1 with &v=b&cs=wh.
Related
I am trying to send SMIME signed email and fail.
I use Python 3, so I chose the poor-smime-sign library.
Using Thunderbird to recieve, I either get an empty email with "undisclosed recipients" and no subject, which is signed or I get the whole thing in plain-text, printing a huge blob of base64 with the message-body - no sign of signing (pun unintended, noticed and left intact).
I have compared the source of a working email (created by Thunderbird from my sent folder) with my franken-mails, but I don't quite see the difference.
Here's the code:
from poor_smime_sign import smime_sign
def signEmail(self, message :str) -> str:
"""Sign the message-body.
The message is encoded in UTF-8, signed and then returned as Unicode.
Check this document on how to generate untrusted example-keys:
https://tools.ietf.org/doc/python-m2crypto/howto.smime.html
Check the settings ('invmail'->'keydir') where to put the keys.
The privateKey is called 'signer_key.pem' and publicKey 'signer.pem'.
"""
import os
privateKey = os.path.join(settings.SF.mail['keydir'], 'signer_key.pem')
publicKey = os.path.join(settings.SF.mail['keydir'], 'signer.pem')
try:
signed = smime_sign(publicKey, privateKey, message.encode('UTF-8'))
except Exception as e:
raise(Exception("Problem during signing: "+str(e)))
return signed.decode('UTF-8')
poor_smime_sign btw is pretty humble about their module, which I quite like. I looked at their code and all they do is call openssl, which is what I would have done, too, as the next step. If you're troubleshooting you can go into the mod and log the command that gets executed and fiddle with that in a shell until you understand why it fails. I e.g. had pub and priv cert the wrong way and got a really stupid error message.
This is what puts the message together in the end. I had copied it from some example somewhere.
body = self.signEmail(body)
emailAr = [
"From: %s" % emailFrom,
"To: %s" % emailTo,
"Subject: %s" % subject,
"", # <- that one
body,
]
message = "\r\n".join(emailAr)
#...
server.sendmail(emailFrom, [emailTo], message.encode('UTF-8'))
TL;DR:
Get the headers right: Signing already creates a header. Just add to that. No empty new lines.
Well, turns out I had no idea how email works. I was indeed wondering about why I use the TO-address twice (once constructing the message and once in sendmail()) but it took a while until I figured it out. I knew, that I needed some sort of header but I did not know where and why.
The solution was twofold:
The text that gets signed needs a header so the email client knows what to do with it. I took one from a working email I had lying around.
Looks like this.
cannedHeader = "\r\n".join([
"Content-Type: text/plain; charset=utf-8; format=flowed",
"Content-Language: de-DE",
"Content-Transfer-Encoding: quoted-printable",
"","" # emtpy new line concludes header
])
body = cannedHeader+bodyInput
body = self.signEmail(body)
The signed message-body already comes with a partial header attached to it. Printing out the result of signing, you see it starts with
MIME-Version: 1.0 Content-Type: multipart/signed;
protocol=3Dpplication/x-pkcs7-signature"; m= icalg=3Dha-256";
boundary=3D---DF20A931579CC3CE98F68AEF4D387131"
This is an S/MIME signed message
------DF20A931579CC3CE98F68AEF4D387131
And I ran that through the initial version of the code, generating two headers in the process. One with recipients and subject suffixed by an empty new line, and then added the signed message-body, which had another header, containing SMIME information, also suffixed by an empty new line. That could not work. So removing the empty line (in the question marked with "that line") fixed this.
As I have not found any example on stackexchange, I thought I'd write this down, so I can find it when I need it the next time.
I'm working on project which can access all the pictures in g-mail.I've tried the G-mail API using node which can fetch all required attachments.But that requires to download the whole image.I can access the attachment id and message id using the API.Is there any way to generate the url of attachment (to view) so that i can provide a link to the required image from my project.
I actually found this related issue, Issue #134, and you may want to try the suggested solution.
You may fetch email attachments using this:
https://mail.google.com/mail/u/0/?ui=2&ik={ik_value}&view=att&th={message_id}&attid=0.{atachment_index}&disp=safe&zw
wherein, attachmment_index is just the index of the attachment. If there are 3 attachments and you want to get the 3rd file, the index value will be 3. This URL is a 302 header that acts like a link shortener for the download file. Opening this link will lead you to the attachment data
var ik = gmail.tracker.ik;
var id = gmail.get.email_id();
var aid = "1"; // gets the first attachment
var url = "https://mail.google.com/mail/u/0/?ui=2&ik=" + ik + "&view=att&th=" + id + "&attid=0." + aid + "&disp=safe&zw";
console.log(url);
I've been using PHPMailer successfully for a couple of years. I just refreshed my PHPMailer class from their github site, and now my server throws 500 errors. I tracked down the problem to this line (simplified for this post):
$mail->Body = "<p>Hello World</p>";
All of the example that I see on the worxware website these days show the body of the email being read from a file like this:
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->MsgHTML($body);
I also tried modifying my code to use the MsgHTML syntax, but I still have the same result:
$body = "<p>Hello World</p>";
$mail->MsgHTML($body);
I can't imagine that it matters whether this body gets populated from a file or from a local variable, but nothing that I try works. What am I missing? Thanks!
$output = str_replace(array("\n","\r"),"",$output);
try this
I am trying to delete a specific recipient from an envelope. I wrote a little Java program and tried various DELETE requests, but I always get an error back:
<errorCode>INVALID_REQUEST_BODY</errorCode>
<message>The request body is missing or improperly formatted. <signers xmlns=''> was not expected.</message>
I tried with this request:
baseURL + "/envelopes/" + envelopeId + "/recipients/"+recipientId;
and no body
as well as:
baseURL + "/envelopes/" + envelopeId + "/recipients/"
with body="<recipients xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.docusign.com/restapi\"><agents><agent><recipientId>"+recipientId+"</recipientId></agent></agents></recipients>";
Both without success.
Have you tried referring to the DocuSign REST documentation regarding deleting recipients?
https://www.docusign.com.au/p/RESTAPIGuide/RESTAPIGuide.htm#REST API References/Delete Recipients from an Envelope.htm?Highlight=delete recipient
I would like to know how to send email to multiple recipients by phpmailer while the email address is input by the user at the front-end rather than hard-code the address at the back-end.
Please kindly advise.
Thanks,
Wayne
Passing the emails and names to your script, and then simply calling the AddAddress method when you're processing the incoming information would do it.
It isn't clear from your question whether you want to have multiple or single recipients.. it's a little contradictory. Here's a basic example for multiple recipients with their names and emails in an array:
require 'class.phpmailer.php';
$mail = new PHPMailer;
/*
set up your email here...
*/
foreach ($recipients as $email => $name) {
$mail->AddAddress($email, $name);
}
/*
Then send your email..
*/
What have you tried?