Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all 29769 articles
Browse latest View live

Anyone Familiar with GMail API x Wordpress x WP SMTP Mail plugin?

$
0
0

[gmail-api] I have a ecommerce site on wordpress. Using WP Mail SMTP, I connected a new GSuite email address after removing my old gmail API Credentials so the emails can come from .domain. However, now it seems the test emails being sent from my GSuite email is getting rejected and at this point, I've received a notice "You have reached a limit for sending mail. Your message was not sent."


Sending Multiple emails with Different Attachments

$
0
0

I am trying to send emails to a list of recipients in an Excel spreadsheet, with a different attachment for each of the emails.

I created a macro that generates the different emails, but when I added attachments, only the first email of the list is created with the correct attachment.

When the loop comes back to the second email it gives me an error message saying that the attachment was not found (I assume this is for the second message).

I checked and the file names and paths are correct according to the rules I set in the code. It doesn't create a draft of the second email, but simply tells me the file was not found.

How can I generate all of the emails with their proper attachments?

The code is as follows:

Sub clientemails()

Dim pfolio As String
Dim destino As String
Dim mo As String
Dim text As String
Dim subject As String
Dim CC As String
Dim signature As String
Dim officer As String
Dim yr As String
Dim date1 As String
Dim position As String
Dim analysis As String
Dim activities As String

Dim nl As Integer
Dim i As Integer

Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.mailitem

Set OutlookApp = New Outlook.Application

nl = Cells(5, 1).End(xlDown).Row
i = 5

yr = Cells(1, 6).Value
date1 = Format(Cells(1, 4).Value, "mm.dd.yy")

While nl + 1 > i

    pfolio = Cells(i, 2).Value
    destino = Cells(i, 3).Value
    officer = Cells(i, 10).Value
    CC = Cells(i, 11).Value

    Set MItem = OutlookApp.CreateItem(olmailitem)

    If Cells(i, 9) = "P" Then

        mo = Cells(1, 3)
        subject = "Posição e Análise "& pfolio
        text = "<p><font face=arial size=3>Bom Dia,</p>" _
          & "<p>Segue em anexo a posição e análise da carteira "& pfolio & " referente ao mês de "& mo & ". Caso tenha quaisquer dúvidas, favor entrar em contato conosco.</p>" _
          & "Atenciosamente,"

    ElseIf Cells(i, 9) = "E" Then

        month = Cells(2, 3)
        subject = pfolio & " Statement and Analysis"
        text = "<p><font face=arial size=3>Hello,</p>" _
          & "<p>Please find attached the portfolio statement and analysis for the "& pfolio & " portfolio for the month of "& mo & ". Should you have any questions, please don't hesitate to contact us.</p>" _
          & "Sincerely,"
    End If

    If Cells(i, 4) = "X" Then

        position = "F:\Files\General Folders\3 Clients\"& officer & "\"& pfolio & "\Position\"& yr & "\"& pfolio & " Portfolio Statement Summary "& date1 & ".pdf"
        With MItem
            .Attachments.Add position
        End With

    End If

    If Cells(i, 5) = "X" Then

        analysis = "F:\Files\General Folders\3 Clients\"& officer & "\"& pfolio & "\Portfolio Analysis\"& yr & "\"& pfolio & " Portfolio Analysis "& date1 & ".pdf"
        With MItem
            .Attachments.Add analysis
        End With

    End If

    If Cells(i, 6) = "X" Then

        activities = "F:\Files\General Folders\3 Clients\"& officer & "\"& pfolio & "\Portfolio Activities\"& yr & "\"& pfolio & " Portfolio Activities "& date1 & ".pdf"
        With MItem
            .Attachments.Add activities
        End With

    End If

    With MItem
        .Display
    End With

    signature = MItem.HTMLBody

    With MItem
        .subject = subject
        .To = destino
        .CC = CC
        .HTMLBody = text & signature
        .Save
    End With

    i = i + 1

Wend

End Sub

Laravel error when sending custom email address using smtp server

$
0
0

I have a project that has a module that sends email from request. Im using beautymail package for the email template. I can send an email using a gmail account, but there is this email that I get from my client that has a custome email address in it. Like this xx.xxxxx@propnex.sg, they said that the email is a smtp server. So I tried configuring my .env and other configuration files in laravel. But I get this error upon sending Connection could not be established with host mail.propnex.sg :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number Could someone tell me why Im getting this error and what should I do to get rid of this? Thanks a lot

.env config

MAIL_DRIVER=smtp
MAIL_HOST=mail.propnex.sg
MAIL_PORT=587
MAIL_USERNAME=xx.xxxxx@propnex.sg
MAIL_PASSWORD=xxxxxxxx
MAIL_ENCRYPTION=ssl

Mail.php

'from' => [
        'address' => 'xx.xxxxx@propnex.sg',
        'name' => 'Propnex',
    ],

    'reply_to' => ['address' => 'xx.xxxxx@propnex.sg', 'name' => 'Propnex'],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),


    'username' => env('MAIL_USERNAME'),

    'password' => env('MAIL_PASSWORD'),

    'port' => env('MAIL_PORT', 587),

    'driver' => env('MAIL_DRIVER', 'smtp'),

    'host' => env('MAIL_HOST', 'mail.propnex.sg'),

wordpress wp_mail throws error: could not instantiate mail function

$
0
0

I have two forms in my website. Both were working fine. but suddenly now they are not working. Emails are not going from both the forms.

// This function gets called when user clicks on submit button

<script type="text/javascript">
      var $ = jQuery;
            function sendMessage(){
            var name = $('[name="name"]').val();
            var email = $('[name="email"]').val();
            var phone = $('[name="phone"]').val();
            var message = $('[name="message"]').val();
            var filter = /^[7-9][0-9]{9}$/;
            var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

            if(name == '')
            {
                $('.name-error').show();
            }
            else
            {
                $('.name-error').hide();
            }
            if(email == '')
            {
                $('.email-error').show();
            }
            else
            {
                $('.email-error').hide();
            }
            if(phone == '')
            {
                $('.phone-error').show();
            }
            else
            {
                $('.phone-error').hide();
            }
            if(message == '')
            {
                $('.message-error').show();
            }
            else
            {
                $('.message-error').hide();
            }

            if(name != ''&& email != ''&& phone != ''&& message != ''){
                if(emailReg.test(email)){
                    if(filter.test(phone)){
                        var data = {
                            url:        '<?php echo admin_url('admin-ajax.php');?>',
                            type:       'POST',
                            action:     'send_mails',
                            formdata: $("#contact").serialize()
                        };

                        var myRequest = jQuery.post(data.url, data, function(response){
                            console.log(response)
                        });

                        myRequest.done(function(){
                            $('#msg').html("<p class='msg' style='background-color:#dff0d8; border-color: #d6e9c6; color:#3c763d; padding:10px; border-radius:4px;'>The Email has been sent successfully!</p>").fadeIn('slow');
                            $('#msg').delay(5000).fadeOut('slow');
                        });
                        $("#contact").trigger("reset");
                        $('#msg').html("<p class='msg' style='background-color:#dff0d8; border-color: #d6e9c6; color:#3c763d; padding:10px; border-radius:4px;'>The Email has been sent successfully!</p>").fadeIn('slow');
                            $('#msg').delay(5000).fadeOut('slow');
                    }
                    else
                    {
                        alert("Provide valid mobile number");
                    }
                }
                else
                {
                    alert("Provide valid Email Id");
                }
            }
            else
            {
                // alert("Kindly enter all the details");
                return false;
            }

        } 
    </script>

This is function from functions.php file.

    function send_mails()
    {
        $formData = $_POST['formdata'];
        $data = array();
        parse_str($formData, $data);

        $name = $data['name'];
        $email = $data['email'];
        $phone = $data['phone'];
        $message = $data['message'];

        $msg = "A new enquiry has been posted on the website\n";
        $msg.= "Name: ".$name."\n";
        $msg.= "Email: ".$email."\n";
        $msg.= "Phone: ".$phone."\n";
        $msg.= "Message: ".$message."\n";

        $headers = array('Content-Type: text/html; charset=UTF-8');

        //echo $msg;

        $admin_email = get_option( 'admin_email' );
        //  print_r($admin_email);
        $res = wp_mail('email',"Enquiry",$msg,$headers);
        if($res)
        {
            echo "Mail has been sent";

        }
        else
        {
            echo "Could not send mail";
            debug_wpmail($res);
        }

        die();
    }

    add_action('wp_ajax_send_mails', 'send_mails');
    add_action('wp_ajax_nopriv_send_mails', 'send_mails');

debug_wpmail returns the error "Could not instantiate mail function". I did not find anything on google.

if ( ! function_exists('debug_wpmail') ) :
    function debug_wpmail( $result = false ) {
        if ( $result )
            return;
        global $ts_mail_errors, $phpmailer;
        if ( ! isset($ts_mail_errors) )
            $ts_mail_errors = array();
        if ( isset($phpmailer) )
            $ts_mail_errors[] = $phpmailer->ErrorInfo;
        print_r('<pre>');
        print_r($ts_mail_errors);
        print_r('</pre>');
    }
endif;

HTML E-mail signature generation from a template and xlsx for data

$
0
0

The question is simple.

I have an HTML E-mail signature template, and got the data which needs to be generated into the template. The different columns corresponds to different data: Name, Position, Mobile Phone, and Site location

Is there any software or javascript thingy which can do this? The manual instertion is not a choice, since I've got almost 400 signature to generate.

Thank you very much in advance,

Bence

Receiving an approval via outlook email and invoke a java method [closed]

$
0
0

We have a requirement where customer will send an email to a particular system user's mailbox with a predefined text, such as 'Approved' or 'Rejected'. the exchange server is MS Outlook. We have to read this message and invoke necessary actions. The actions will be invocation of a Rest API. Kindly suggest how to achieve this. Is Actionable Message the right way ? Thanks Deb

Can I Send Emails to Multiple Receivers using IEmailSender Interface in ASP.Net Core 3.0

$
0
0

I'm beginner to ASP.Net core. Actually I'm using ASP.Net Core 3.0. I want to Send emails to Multiple Receivers. Can I use IEmailSender Interface? Or any suggetion?

My IEmailSender implementation is like,

public class EmailSender : IEmailSender
{
    private string host;
    private int port;
    private bool enableSSL;
    private string userName;
    private string password;

    public EmailSender(string host, int port, bool enableSSL, string userName, string password)
    {
        this.host = host;
        this.port = port;
        this.enableSSL = enableSSL;
        this.userName = userName;
        this.password = password;
    }

    public Task SendEmailAsync(string email, string subject, string htmlMessage)
    {
        var client = new SmtpClient(host, port)
        {
            Credentials = new NetworkCredential(userName, password),
            EnableSsl = enableSSL
        };
        return client.SendMailAsync(
            new MailMessage(userName, email, subject, htmlMessage) { IsBodyHtml = true }
        );
    }
}

Can anyone help me?

email client failing to add second recipient

$
0
0

I am currently working on an emailspammer which is on github: (Spammer) And the code basically works, but the program wont add another recipient. When checking the recipients, it shows them as added, but the emails dont get delivered. Im not getting errors either. Any help? all the code is on github, it is too much to add into this question. (sorry!)


Odoo [12] : How to Add button in mail.chatter.Buttons(Chatter) same like Send Message?

$
0
0

How to Add button in mail.chatter.Buttons (Chatter) same like Send Message, Log note and Schedule activity. if you know how to do it please let me know.

Thanks in Advanced

move (copy) IMAPMessage to another folder on the mail server

$
0
0

My application is checking the patterns of the subjects of the mails on the Inbox server folder and if some pattern is found, we should move the email (com.sun.mail.imap.IMAPMessage) to another folder - called 'test' for example (copy will do the job also).

I searched on the Internet for the solution but I could not find anything helpful.

Can you tell me how can I move / copy IMAPMessage from inbox to another folder on server?

Thank you

Trigger event on incoming emails Outlook in C# addin

$
0
0

I am figuring a way out to trigger an event when an email comes in inbox. No problem for the default folder but need to make sure it does this for all accounts. Here is my code:

outlookNameSpace = this.Application.GetNamespace("MAPI");
foreach(MAPIFolder folder in outlookNameSpace.Folders) {
    GetFolders(folder);
}
void GetFolders(MAPIFolder folder) {
    if (folder.Folders.Count == 0) {
        //this loops through all the folders but it should check if it is an inbox folder with a 
        //new email and than trigger ItemsEvents_ItemAddEventHandler
        items.ItemAdd +=
            new Outlook.ItemsEvents_ItemAddEventHandler(items_ItemAdd);
    } else {
        foreach(MAPIFolder subFolder in folder.Folders) {
            GetFolders(subFolder);
        }
    }
}

PHP mail function is sending blank message body

$
0
0

I am aware there are other subjects with similar questions however their answered didn't solve my problem.

I developed a website and temporarily decided to go ahead and use PHP mail as opposed to other routes as it was the quickest and easiest (I am an amateur developer). It was working flawlessly for the past month with no issues, however 3 days ago, I started receiving emails with no message contents (these are not spam or just empty messages, I am aware that I should use validation etc).

I still successfully receive the email to my email account, it also contains the subject header being "Contact Form Request", however the body is empty i.e. $msg that should be populated aren't?

I switched over the placement of "Contact Form Request" and $msg and the $msg contents would be received in the email subject header so it is being populated, however the message body remains empty.

Any help would be appreciate.

contact.html

<div id="contact-form">
        <form action="contact.php" method="post">

          <div class="form-group">
            <label for="inputName">Name *</label>
            <input type="text" class="form-control" name="name" placeholder="Enter name" required>
          </div>

          <div class="form-group">
            <label for="inputNumber">Contact Number *</label>
            <input type="tel" class="form-control" name="phone" placeholder="Enter contact number" required inputMode="tel">
          </div>

          <div class="form-group">
            <label for="inputEmail">Email *</label>
            <input type="email" class="form-control" name="email" placeholder="Enter email" required>
          </div>

          <div class="form-group">
            <label for="inputSubject">Subject *</label>
            <input type="text" class="form-control" name="subject" placeholder="Enter subject" required>
          </div>

          <div class="form-group">
            <label for="inputMessage">Message *</label>
            <textarea type="text" class="form-control" name="message" placeholder="Enter message" rows="3" required maxlength="300"></textarea>
          </div>

          <p><small><strong>*</strong> These fields are required.</small></p>

          <button type="submit" class="btn btn-send">Send</button>

        </form>
      </div>

contact.php

<?php

$webmaster_email = "test@drivingschool.co.uk";

$success_page = "thankyoucontact.html";

$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];

$msg =
"You have received a message from " . $name . "\r\n\n" .
"Subject: " . $subject . "\r\n\n" .
"Message: " . $message . "\r\n\n" .
"Name: " . $name . "\r\n" .
"Phone: " . $phone . "\r\n" .
"Email: " . $email . "\r\n\n\n\n" .
"DISCLAIMER:\r\n\nThis e-mail and any attachments is a confidential correspondence intended only for use of the individual or entity named above. If you are not the intended recipient or the agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender by phone or by replying this message, and then delete this message from your system.";

mail($webmaster_email, "Contact Form Request", $msg);
header("Location: $success_page");

?>

How to set reply-to when using Swiftmailer

$
0
0

How can reply-to be set when using Swiftmailer. The docs mentioned the function setReplyTo() but without specific instructions on how to use it.

Any help will be appreciated.

Can we change email content for bcc only Using SendGrid Personalization?

$
0
0

I have an email for customer, Its bcc we have the Subscriber's company Email.Email Contain a link to web page.Now the problem is the link is passing IsCustomer=true which becomes the reason for a function to be executed.I want to replace IsCustomer=true with IsCustomer=false or disable the link for BCC only. I do not have an option to send two separate emails. Technically, the requirement seems weird to me as why we should be able to change the email content of same email for recipient and BCC. I have studied the personalizations topic here and I am doubtful about this. Is there any way to achieve that?

Open Outlook with Attachment from Shiny

$
0
0

I'd like to open the standard email programm (Outlook) with prefilled values. It is traight forward to define recipients, subject, and body via mailto, yet manypostspointout that it is not possible to add an attachment by this logik. While therearemanysuggestions, I have failed to acheive this via JS or HTML. I cannot use R packages like mailR etc. since the server does not allow for it.

Any specfic hints how it can be acheived that, as soon as somebody clicks on the button, an email with an attached file, defined by a local path, opens? Any help is much appreciated!

library(shiny)
ui <- shinyUI(fluidPage(
  sidebarLayout(
    sidebarPanel(
      uiOutput("mail") 
      # If the user could specify the file by himself
      # ,HTML('<td><input id="filefield" type="file" name="file" size="24"></td>')
    ),
    mainPanel(),
    position = "left"
  )
)
)

server <- shinyServer(function(input, output) {
  observe({
    mail_address <- "mrx@gmail.com"
    cc_recipients <- "mrsx@g.mail"
    bcc_recipients <- "mr.x@googlr.com"
    subject <- "My Report"
    text <- "See attachment"
    attachment_file <- "myfile.txt"

    output$mail <- 
      renderUI({
        a(actionButton(inputId = "email1", label = "Send Mail",
                       icon = icon("envelope", lib = "font-awesome")),
          href = paste0("mailto:", mail_address,
                        "?cc=", cc_recipients,
                        "&bcc=", bcc_recipients,
                        "&body=", text, 
                        "&subject=", subject,
                        "&attachments=", attachment_file))
      }
      )
  })

})
shinyApp(ui, server)

Issue with sending codeigniter view in email

$
0
0

I am trying to send email in codeigniter. I'm sending view in message body.But I'm getting error as shown in imageError and it displaying view below the error. My code is as below.$msg = $this->load->view('FolderName/sendEmail.php',TRUE); I have also tried$msg = $this->load->view('FolderName/sendEmail.php',TRUE); But with this code I'm not receiving any email. Please help me to find out the solution.

Laravel Imap connect() slow | reuse?

$
0
0

I am using laravel-imap to connect to my email server and get all mailboxes and messages.

I noticed that the connect() method is slow, it takes 4-5 sec.:

$start = microtime(true);

$oClient = new Client([
    'host'          => env('MAIL_HOST_IN'),
    'port'          => env('MAIL_PORT_IN'),
    'encryption'    => env('MAIL_ENCRYPTION_IN'),
    'validate_cert' => true,
    'username'      => env('MAIL_USERNAME'),
    'password'      => env('MAIL_PASSWORD'),
    'protocol'      => 'imap'
]);

// Connect to the IMAP Server
$oClient->connect(); 

\Log::info('Connect: ' . strval(microtime(true) - $start));

Thats it, there is no additional code. I also use getFolders() and loop through them to get messages. I count/get unseen messages and do more operations, but they are all fast.

I am asking this, because if I login into my mailbox through the website, the performance is much better 1-2 sec. And the operation is the same, I get the mailboxes and a count on unseen messages. So why it is slow via script?

In case it simply is like that and I cant change it, what are some possible solutions? The only idea I have right now it to reuse the connection in multple functions, so at least I connect only once.

.NET Outlook Default folder free space

$
0
0

Is there any way to read via Microsoft.Office.Interop free space left in default Mailbox ?

(So the same info what is displayed in Outlook's down left corner - as shown below)

enter image description here

Odoo HelpDesk notify the assigned user of a ticket

$
0
0

I'm trying to setup that a User get notified by mail, if a ticket will be assigned to him in Odoo V12.

Unfortunately I wasn't able until now to set it up correctly.

The object which needed to be used for the logical setup:

field: user_id
object: helpdesk.ticket
Typ: many2one
Relation: res.users

Is it possible without coding it by myself?

Nodemailer Oauth2 error : unauthorized_client

$
0
0

I'am trying to send mail using Oauth and nodemailer on a nodejs app, I did it without Oauth but my password was wrote in the code so I turn myself to Oauth.

I only want to connect myself to send mail in an automatic way. I have settup a project and a service account on google cloud platform. I added the gmail api and wrote some code :

 var smtpTransport = nodemailer.createTransport({
   host:'smtp.gmail.com',
   port:465,
   secure:true,
   auth:{
     type: 'OAuth2',
     user: 'thomas.legrand.test@gmail.com',
     serviceClient:config.client_id,
     privateKey:config.private_key
   }
 });
 var mail = {
   from: "thomas.legrand.test@gmail.com",
   to: "thomas.legrand26@gmail.com",
   subject:"Un sujet abstrait",
   html:"<h1> Ceci est un mail de test </h1><h2> et ceci un sous titre </h2> "
 };

 smtpTransport.on('token', token => {
    console.log('A new access token was generated');
    console.log('User: %s', token.user);
    console.log('Access Token: %s', token.accessToken);
    console.log('Expires: %s', new Date(token.expires));
});

smtpTransport.sendMail(mail, function(error, response) {
        if(error) {
          console.log("Erreur lors de l'envoie du mail ");
          console.log(error);
        }else {
          console.log("succes")
        }
        smtpTransport.close();
      });

But I get an error (unauthorized_client) which I can't solve.

I hope you can help me or give me hints at least !

Viewing all 29769 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>