logo
down
shadow

Attachment not being sent with email - GScript


Attachment not being sent with email - GScript

By : Veronica Calderon
Date : November 18 2020, 03:01 PM
should help you out It seems that from your added log, retrieving the file blob you want to send works. So how about a following modification?
From :
code :
MailApp.sendEmail([Email, subject, body, {noReply=true, attachements=[Blob]}])
MailApp.sendEmail({
  to: Email,
  subject: subject,
  body: body,
  noReply: true,
  attachments: [pdf]
});


Share : facebook icon twitter icon
VBA Code to save an attachment (excel file) from an Outlook email that was inside another email as an attachment

VBA Code to save an attachment (excel file) from an Outlook email that was inside another email as an attachment


By : user3687281
Date : March 29 2020, 07:55 AM
around this issue The code below uses this approach to work on the email as an attachment
Tests whether the attachment is an email message or not (if the filename ends in msg) If the attachment is a message, it is saved as "C:\temp\KillMe.msg". CreateItemFromTemplate is used to access the saved file as a new message (msg2) The code then processes this temporary message to strip the attachmnets to fsSaveFolder If the attachment is not a message then it is extracted as per your current code
code :
   Sub SaveOlAttachments()

    Dim olFolder As Outlook.MAPIFolder
    Dim msg As Outlook.MailItem
    Dim msg2 As Outlook.MailItem
    Dim att As Outlook.Attachment
    Dim strFilePath As String
    Dim strTmpMsg As String
    Dim fsSaveFolder As String

    fsSaveFolder = "C:\test\"

    'path for creating attachment msg file for stripping
    strFilePath = "C:\temp\"
    strTmpMsg = "KillMe.msg"

   'My testing done in Outlok using a "temp" folder underneath Inbox
    Set olFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
    Set olFolder = olFolder.Folders("Temp")
    If olFolder Is Nothing Then Exit Sub

    For Each msg In olFolder.Items
        If msg.Attachments.Count > 0 Then
        While msg.Attachments.Count > 0
        bflag = False
            If Right$(msg.Attachments(1).FileName, 3) = "msg" Then
                bflag = True
                msg.Attachments(1).SaveAsFile strFilePath & strTmpMsg
                Set msg2 = Application.CreateItemFromTemplate(strFilePath & strTmpMsg)
            End If
            If bflag Then
                sSavePathFS = fsSaveFolder & msg2.Attachments(1).FileName
                msg2.Attachments(1).SaveAsFile sSavePathFS
                msg2.Delete
            Else
                sSavePathFS = fsSaveFolder & msg.Attachments(1).FileName
                msg.Attachments(1).SaveAsFile sSavePathFS
            End If
            msg.Attachments(1).Delete
            Wend
             msg.Delete
        End If
    Next
    End Sub
Get file attachment path in AEM Adaptive Form to use in JSP to send email with attachment?

Get file attachment path in AEM Adaptive Form to use in JSP to send email with attachment?


By : user4445179
Date : March 29 2020, 07:55 AM
it helps some times Finally i got it! I'm sharing the answer to help some one else.
This is my final code:
code :
ValueMap props = ResourceUtil.getValueMap(resource);
    HtmlEmail email = new HtmlEmail();
    String[] mailTo = props.get("mailto", new String[0]);
    email.setFrom((String)props.get("from"));
        for (String toAddr : mailTo) {
            email.addTo(toAddr);
      }
    //========Email Attachments===============
    for (Map.Entry<String, RequestParameter[]> param : slingRequest.getRequestParameterMap().entrySet()) {
        RequestParameter rpm = param.getValue()[0];
        if(!rpm.isFormField()) {
            EmailAttachment attachment = new EmailAttachment();
            attachment.setPath(rpm.getFileName());
            attachment.setDisposition(EmailAttachment.ATTACHMENT);
            attachment.setDescription("Any Description");
            attachment.setName("Any name you can set");
            email.embed(new ByteArrayDataSource(rpm.get(), rpm.getContentType()), rpm.getFileName());
        }
    }
    //========Email Attachment END===========

    String emailTextToSend = "<p>Name: " + slingRequest.getParameter("name") + "</p>";
    emailTextToSend += "<p>Message: " + slingRequest.getParameter("message") + "</p>";
    email.setHtmlMsg(emailTextToSend);
    email.setSubject((String)props.get("subject"));
    MessageGatewayService messageGatewayService = sling.getService(MessageGatewayService.class);
    MessageGateway messageGateway = messageGatewayService.getGateway(HtmlEmail.class);
    messageGateway.send(email);
GScript: Track number of emails sent using mass email Gscript code

GScript: Track number of emails sent using mass email Gscript code


By : Saleh Gahwari
Date : March 29 2020, 07:55 AM
it should still fix some issue I am trying to modify this GScript to count the number of emails sent. I would like to track the total number of emails sent using this function. Would it be easier to do it within this code or to use a code to search the sent box of the user? I believe I know how to make a count value get stored temporarily, but I am unsure how to store it for a greater period of time. , Requirement:
Record amount of emails sent by this script.
code :
var total = GmailApp.search('in:sent subject:"'+esubject+'"').length;
Logger.log(total);
GScript to Convert multiple sheets from the same document to individual PDFs and send each PDF to an email address conta

GScript to Convert multiple sheets from the same document to individual PDFs and send each PDF to an email address conta


By : user3351090
Date : March 29 2020, 07:55 AM
I wish this help you I am looking for a script that will take each sheet in one file, convert each sheet to a PDF, and send that PDF to the recipient listed in that sheet. , I think this might help you
code :
    function myFunction(){

    var ss = SpreadsheetApp.openById("YOUR_SPREADSHEET_ID");
    var sheets = ss.getSheets();

    var B2Values = [];
    sheets.forEach(function(elt,index){
    //Get all  your email adresses
    B2Values.push(sheets[index].getRange(2,2).getValue());
    });

    //For each sheet in your Spreadsheet, it create a temporary Spreadsheet
 //who got only one sheet, with your sheet values, 
// transform it as pdf, send the pdf by email to your B2 email adress and delete
//the temporary Spreadsheet

    sheets.forEach(function(elt, index){
    var temporarySS = SpreadsheetApp.create("NAME_OF_THE_FILE_WHO_WILL_BE_SENT");
    var temporaryId = temporarySS.getId();
    var dataToMove = sheets[index].getRange(1,1,sheets[index].getLastRow(),sheets[index].getLastColumn()).getValues();
    var openingTemporarySS = SpreadsheetApp.openById(temporaryId);
      dataToMove.forEach(function(elt){
      openingTemporarySS.appendRow(elt);
      })
     MailApp.sendEmail({
        to: B2Values[index],
        subject: "YOUR_SUBJECT",
        attachments: [openingTemporarySS.getAs('application/pdf')]
    })

    DriveApp.getFileById(temporaryId).setTrashed(true);

    });
    }
function myFunction(){

var ss = SpreadsheetApp.openById("YOUR_SPREADSHEET_ID");
var sheets = ss.getSheets();

var B2Values = [];
sheets.forEach(function(elt,index){
//Get all  your email adresses
B2Values.push(sheets[index].getRange(2,2).getValue());
});

var temporarySS = SpreadsheetApp.create("NAME_OF_THE_FILE_WHO_WILL_BE_SENT");
var temporaryId = temporarySS.getId();
var openingTemporarySS = SpreadsheetApp.openById(temporaryId);

sheets.forEach(function(elt, index){
var dataToMove = sheets[index].getRange(1,1,sheets[index].getLastRow(),sheets[index].getLastColumn()).getValues();
  dataToMove.forEach(function(elt){
  openingTemporarySS.appendRow(elt);
  })
 MailApp.sendEmail({
    to: B2Values[index],
    subject: "YOUR_SUBJECT",
    attachments: [openingTemporarySS.getAs('application/pdf')]
})
openingTemporarySS.deleteRows(1,openingTemporarySS.getLastRow());
});

DriveApp.getFileById(temporaryId).setTrashed(true);
}
Email attachment appears in email body as plain text in Laravel 4.2 rather than attached to email

Email attachment appears in email body as plain text in Laravel 4.2 rather than attached to email


By : small pot
Date : March 29 2020, 07:55 AM
like below fixes the issue Some fresh eyes and a nights sleep and I have resolved this issue. Adding text into the email view seemed to solve the problem; a simple yet effective solution.
shadow
Privacy Policy - Terms - Contact Us © voile276.org