I'm using the new 6.x version and it appears the voucher isn't being sent. Has anyone else experienced this problem?

Comments

mpaler’s picture

email isn't in my spam box..

dear_anton’s picture

Do you have sendmail or other mail service correctly configured at your host?

You may try drupal_mail() function to test it. If still no mail it is a hosting problem.

mpaler’s picture

Hi,

My server settings were are ok. All other drupal mail sending happens ok.

It appears the arguments you were supplying to drupal_mail were not formatted correctly. I modified invvoucher_send_invite by modifying drupal_mail_send() (see code below) and now it works ok for me...

/**
 *   Send email with code
 */
function invvoucher_send_invite($op, $user_name = '[username]', $email = '[recipient-email]', $code = 'registration-code', $message = '[your message]', $expired='[days left]', $quantity='[possible registrations]'){

global $base_url, $user;

$default_from = variable_get('site_mail', ini_get('sendmail_from'));
$subject = variable_get('invvoucher_subject', t("You've been invited"));
$template = invvoucher_get_mail_template();
$site = variable_get('site_name', t('Drupal'));
$join_link = variable_get('invvoucher_register_URL', $base_url);
$homepage = $base_url;
$inviter = $user_name;

if ($quantity == -1){
	$quantity = t("any number of");
}

$body = t($template, array('@site' => $site, '@join_link' => $join_link, '@homepage' => $homepage, '@message' => $message, '@inviter' => $inviter, '@number' => $code, '@expired' => date("Y-m-d",$expired), '@quantity'=> $quantity));

// Bundle up the variables into a structured array for altering.
$message = array(
  'id'       => 'invite-email',
  'to'       => $email,
  'from'     => isset($from) ? $from : $default_from,
  'language' => $language,
  'params'   => $params,
  'subject'  => $subject,
  'body'     => $body
);

// Build the default headers
$headers = array(
  'MIME-Version'              => '1.0',
  'Content-Type'              => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
  'Content-Transfer-Encoding' => '8Bit',
  'X-Mailer'                  => 'Drupal'
);

if ($default_from) {
  // To prevent e-mail from looking like spam, the addresses in the Sender and
  // Return-Path headers should have a domain authorized to use the originating
  // SMTP server. Errors-To is redundant, but shouldn't hurt.
  $headers['From'] = $headers['Reply-To'] = $headers['Sender'] = $headers['Return-Path'] = $headers['Errors-To'] = $default_from;
}

if ($from) {
  $headers['From'] = $headers['Reply-To'] = $from;
}

$message['headers'] = $headers;

// Concatenate and wrap the e-mail body.
//$message['body'] = is_array($message['body']) ? drupal_wrap_mail(implode("\n\n", $message['body'])) : drupal_wrap_mail($message['body']);

// Optionally send e-mail.
  $message['result'] = drupal_mail_send($message);

  // Log errors
  if (!$message['result']) {
    watchdog('mail', 'Error sending e-mail (from %from to %to).', array('%from' => $message['from'], '%to' => $message['to']), WATCHDOG_ERROR);
    drupal_set_message(t('Unable to send e-mail. Please contact the site admin, if the problem persists.'), 'error');
  }

return $message['result'];
}
dear_anton’s picture

Thank a lot for this information. I'll check it nearest time.

usbkabel’s picture

Hi,
I had the same problem.
The workaround from mpaler fixed it.
Thank you very much.

Bananoide’s picture

worked for me too. Thank you so much.

kenorb’s picture

Status: Active » Reviewed & tested by the community

The same problem:

    * warning: mail() [function.mail]: SMTP server response: 501 <You've been invited>: "@" or "." expected after "You've" in mimemail\mimemail.module on line 231.
    * Unable to send e-mail. Please contact the site administrator if the problem persists.

Version in #3 worked.
Thanks.

dear_anton’s picture

Status: Reviewed & tested by the community » Fixed

Hi there!

Fixed that bug.

Great thanks to mpaler!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

aslamc’s picture

how can i modify the file?

do i need to modify the invoucher.module or mail.inc

chrisjohnson’s picture

ah well I got the voucher in the end.