Exemplo n.º 1
0
// opens the template, parse the variables sets the email struct and Send the confirmation code to confirm the ignored contact.
func SendEmailIgnoreme(entity *models.Ignore_List, db gorp.SqlExecutor) {
	//reads the e-mail template from a local file
	wab_email_template := wab_root + "/resource/ignoreme.html"
	template_byte, err := ioutil.ReadFile(wab_email_template)
	checkErr(err, "Ignore-me Email File Opening ERROR")
	template_email_string := string(template_byte[:])

	email_content := sendIgnoreMeSetup(template_email_string, entity, db)

	email := &models.Email{
		TemplatePath: wab_email_template,
		Content:      email_content,
		Subject:      messages.GetLocaleMessage(entity.Lang_key, "MSG_EMAIL_SUBJECT_ADD_IGNORE_LIST"),
		ToAddress:    entity.Contact,
		FromName:     models.WARN_A_BRODA,
		LangKey:      entity.Lang_key,
		Async:        false,
		UseContent:   true,
		HTMLContent:  true,
	}

	sent, response := SendMail(email)
	if sent {
		entity.Message = response
		UpdateIgnoreList(entity, db)
	}
}
// send a SMS with the confirmation code to confirm the ignored contact
func sendSMSIgnoreme(entity *models.Ignore_List, db gorp.SqlExecutor) {

	sms := &models.SMS{
		CredencialKey: os.Getenv("WARNACREDENCIAL"),
		Content:       strings.Replace(messages.GetLocaleMessage(entity.Lang_key, "MSG_SMS_IGNORE_CONFIRMATION_REQUEST"), "{{url}}", models.URL_IGNORE_REQUEST, 1) + entity.Confirmation_code,
		URLPath:       models.URL_MAIN_MOBILE_PRONTO,
		Scheme:        "http",
		Host:          models.URL_DOMAIN_MOBILE_PRONTO,
		Project:       os.Getenv("WARNAPROJECT"),
		AuxUser:       "******",
		MobileNumber:  strings.Replace(entity.Contact, "+", "", 1),
		SendProject:   "N",
	}

	sent, response := SendSMS(sms)

	if sent {
		entity.Message = response
		UpdateIgnoreList(entity, db)
	}
}