Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
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'];
}
* 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.
Comments
Comment #1
mpaler commentedemail isn't in my spam box..
Comment #2
dear_anton commentedDo 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.Comment #3
mpaler commentedHi,
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...
Comment #4
dear_anton commentedThank a lot for this information. I'll check it nearest time.
Comment #5
usbkabel commentedHi,
I had the same problem.
The workaround from mpaler fixed it.
Thank you very much.
Comment #6
Bananoide commentedworked for me too. Thank you so much.
Comment #7
kenorb commentedThe same problem:
Version in #3 worked.
Thanks.
Comment #8
dear_anton commentedHi there!
Fixed that bug.
Great thanks to mpaler!
Comment #10
aslamc commentedhow can i modify the file?
do i need to modify the invoucher.module or mail.inc
Comment #11
chrisjohnson commentedah well I got the voucher in the end.